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);
});
SchemaAggregat Betrieb kommen als null in mongodb
{
"store_id" : "BST000433",
"strProductCode" : "9000000064775",
"dblMRP" : 25,
"intProductQty" : 1,
}
I diese Felder initailized (intProductQty, dblMRP, strPurchasePrice) als ganze Zahl ist. Aber wenn ich obigen Befehl ausführe, bekomme ich diese drei Werte (stockAmount, purchaseAmount, storeValue) als null.
können Sie aktualisieren Ihren Beitrag enthalten Ihr Schema und ein Beispieldokument? – JohnnyHK