Hey guys,
I'm trying to use HAVING COUNT's equivalent in mongo.
I've tried:
messages.aggregate([ { '$match': { count: 1 } } ])
Which in SQL would be HAVING COUNT(*) = 1 right?
This returns an empty array. Shouldn't that really return every document in messages?
What I really want to do is have something like HAVING COUNT(column_name) = 1 in mongo.
For the sake of this lets say the column_name is conversation_id.
I've tried this but it doesn't work, (which isn't surprising considering the above doesn't even work):
messages.aggregate([ { '$match': { count: { conversation_id: 1 } } } } ])
Nobody seems to have done this online, Does anyone know how do I do this kind of thing in mongo?
Many thanks,
Niall