mongodb - count and group by in mongo -


i have mongo collection system , document structure

{     "_id" : "some id",     "created_datetime" : isodate("2013-06-08t21:36:15.173z"),     "installs" : [         {             "country" : "za",             "install_datetime" : isodate("2013-06-08t21:36:15.173z"),             "package_name" : package_name1             "status" : 1,         }     ], }  

i want total installs each "country" each "package_name" "install_date" > july-24-2013, group query in mysql. newbie mongo aggregators, , dont have idea how write mongo aggregator queries

thank you

the aggregation operator interested in $unwind, allow pass installs $group operator, on whichever of country, package_name, or install_date fields interested in.

once you've done $unwind have $group query like:

{ $group : {     _id : "$country",     installpercountry : { $sum : 1 } }} 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -