0
Inventors
.aggregate([{
$match: filter
},
{
$group: {
"_id": {
"store_id": "$store_id"
},
stockAmount: {
$sum: {
$multiply: ["$intProductQty", "$dblMRP"]
}
},
storeValue: {
$sum: "$intProductQty"
},
}
},
])
.exec(function(err, stock) {
return res.send(stock);
});
{
"store_id" : "BST000433",
"strProductCode" : "9000000064775",
"dblMRP" : 25,
"intProductQty" : 1,
}
我initailized這些字段(intProductQty,dblMRP,strPurchasePrice),爲整數。但是當我執行上述命令時,我將這三個值(stockAmount,purchaseAmount,storeValue)設爲null。
您可以更新您的帖子,包括你的模式和樣本文件? – JohnnyHK