MongoDB SELECT COUNT GROUP BY

The Solution to MongoDB SELECT COUNT GROUP BY is


This would be the easier way to do it using aggregate:

db.contest.aggregate([
    {"$group" : {_id:"$province", count:{$sum:1}}}
])

~ Answered on 2014-04-16 17:39:10


Most Viewed Questions: