【发布时间】:2017-02-12 12:10:53
【问题描述】:
我有这样的数据结构:
{
"_id": "order1",
"transactions": [
{
"amount": 100,
"type": "payment"
},
{
"amount": -10,
"type": "refund"
}
]
}
我想得到 100+(-10) = 90 的总和。我是 mongodb 的新手。谁能帮我写查询。
【问题讨论】:
标签: mongodb mongoose mongodb-query aggregation-framework mongodb-aggregation