All the elements - sum
- null
db.simple.aggregate( [ { $group: { _id: null, total: { $sum : "$cnt" } } } ] )
{
"result": [
{
"_id": null,
"total": 26
}
],
"ok": 1
}
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
db.simple.aggregate( [ { $group: { _id: null, total: { $sum : "$cnt" } } } ] )
{
"result": [
{
"_id": null,
"total": 26
}
],
"ok": 1
}