SyntaxFix
Write A Post
Hire A Developer
Questions
This would be the easier way to do it using aggregate:
aggregate
db.contest.aggregate([ {"$group" : {_id:"$province", count:{$sum:1}}} ])