2
我有一个集合:如何汇总嵌套文档?
{
_id : xxx,
children : [
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
}
]
},
{
_id : xxx,
children : [
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
}
]
},
{
_id : xxx,
children : [
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
}
]
},
{
_id : xxx,
children : [
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
},
{
childrenOfChildren : [
{
price : xxx
},
{
price : xxx
},
{
price : xxx
}
]
}
]
}
每个条目都有一个名为孩子的数组。并且每个儿童项目都有一个名为childrenOfChildren的数组。并且childrenOfChildren中的每个条目都有一个名为的属性,价格为。我想在这个整体收藏中获得最大的价格价值。我怎样才能做到这一点?请帮帮我!
可以尝试使用'的[?我怎样才能在嵌套文件最大值(aggregate'查询 –
可能的复制http://stackoverflow.com/questions/41327672 /如何-可以-I-GET-MAX-值在嵌套的文档) – styvane