how to run aggregate query in mongodb client on RockMongo or mViewer
database, mongodb
Solution
You can run aggregate query in "tools->command" panel in your homepage of rockmongo. You may enter query in the input panel like this:
{
aggregate : "ns",
pipeline : [
...
]
}
That will be ok! I have tried, and it works!
Full Example:
{ aggregate : "COLLECTION_NAME",
pipeline : [
{ $unwind : "$SUB_ARRAY" },
{ $match: {"SUB_ARRAY.field": "value"}},
]
}
Problem
I've just started using mongo db, I'm using rockmongo client and my ubuntu terminal as another client. I' ve realized the query using group aggregation like this: ``` db.archiveImpl.group( { key: {accountID: true, phone: true }, cond: {'userId': "oiuoifas2309u"}, reduce: function(object, prev){ }, initial:{} } ``` ) And the above query is not getting run in the `rockmongo` , I initially thought that the query was wrong. and I ran in on the terminal which pulls me the data. So I downloaded and installed `mViewer` and it didn't work either so I believe there is a way to run these kind of queries in mongo web clients thanks for reading this .