你好我有这个json
db.people.insert({
"ad" : "noc2",
"createdDate" : ISODate(),
"list" : [
{
"id" : "p45",
"date" : ISODate("2014-01-01T12:18:30.568Z"),
"value3" : 21,
"value1" : 77,
"value2" : 489
},
{
"id" : "p6",
"date" : ISODate("2013-07-18T12:18:30.568Z"),
"value3" : 20,
"value1" : 20,
"value2" : 7
},
{
"id" : "4578",
"date" : ISODate("2013-07-18T12:18:30.568Z"),
"value3" : 21,
"value1" : 300,
"value2" : -319
}
]
})
我想得到我的数组的最大值。例如,我想要一个这样的json:
“结果”:[{“_id”:“p45”,“价值”:587}]
我的总请求不起作用是:
db.test1.aggregate({$match: "ad":"noc2"},{$unwind: '$list'},{$group: {_id: '$ad', list: {recommand: {$max: '$list'}}}});