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