I am trying to do a group by on a MongoDB collection (my version is 2.2.2)
db.stream.aggregate({$group: { MyId:"A1"}})
But I get the following error:
19 11:56:20 TypeError: db.stream.aggregate is not a function (shell):1
Many Thanks,
You must be using 2.2.+ version of the shell to be able to use the aggregate
helper.
You can check the shell version with version()
command at the shell prompt.
In addition, your aggregation syntax is incorrect - the $group
operator must set a field called _id
(you have MyId
) which is what tells it which field you are aggregating by.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With