Reputation: 45
I need help in this aggregate,
db.billingcycles.aggregate([{
$project:{credit:{$sum:”$credits.value”},debt:{$sum: “debts.value”}},
}, {
$group:{_id:null,credits:{$sum:”$credit”},debt:{$sum:”$debt”}}
}])
Error: 2017-10-13T00:23:16.375-0300 E QUERY [thread1] SyntaxError: illegal character @(shell):2:23
Upvotes: 1
Views: 415
Reputation: 659
try like this
db.billingcycles.aggregate([{
$group: {
"credit": {
$sum: ”$credits.value”
},
"debt": {
$sum: "$debts.value"
}
}
}, {
$project: {
"_id": null,
"credit": 1,
"debt": 1
}
}]
Upvotes: 1