Reputation: 1018
Trying to do aggregate group with more than one { $sum: '$total' }
db.transactions.aggregate([{$group: {_id: '$cashier', cost: {$sum: "$total"}}}, {$group:
{_id: '$deviceid', cost: {$sum: "$total"}}} ])
When i use two aggregates, the second aggregate returns 0.
Av tried to use $project
but still i loose get zero.
Upvotes: 0
Views: 48