Aggregate $ group返回错误的值

时间:2017-12-27 03:45:26

标签: mongodb mongoose aggregation-framework

我有一个名为捐款

的集合
install mvn:com.psl/osgi-demo-next/1.0.0-SNAPSHOT

预期结果

{
    "_id" : 1,
    "reqAmt" : 20,
    "filled" : [
        {
            userId : 1,
            depAmt : 5
        }
    ]
},

{
    "_id" : 2,
    "reqAmt" : 20,
    "filled" : []
},

我尝试了 $ unwind 。但没有运气。它总是返回

{
    "_id" : 1,
    "reqAmt" : 20,
    "filledAmt" : 5
},
{
    "_id" : 2,
    "reqAmt" : 20,
    "filledAmt" : 0
}

以下是代码

{ "_id" : null, "filledAmt" : 0 }

0 个答案:

没有答案
相关问题