Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{"status":"ONBOARD","count":1},{"status":"PENDING","count":1},]
Query
db.collection.aggregate([{$group:{_id:"$status",count:{$sum:1}}},{$project:{_id:0,status:"$_id",count:1}}])
Result