Group by sum mongodb [duplicate]
You're close, but you need to use a $sum
operator to count the groupings:
db.users.aggregate([ {
$group: {
_id: "$status",
amt: { $sum: 1 }
}
} ] )
You're close, but you need to use a $sum
operator to count the groupings:
db.users.aggregate([ {
$group: {
_id: "$status",
amt: { $sum: 1 }
}
} ] )