【发布时间】:2018-11-29 00:09:38
【问题描述】:
我的文档结构如下:
Item:[{
product:"shovel"
price: 100
dateAdded: 2018-11-28 18:28:12.356
}
{
product:"wheel barrow"
price: 500
dateAdded: 2018-11-28 18:28:12.357
}
{
product:"Boot"
price: 500
dateAdded: 2018-11-29 18:29:12.357
}
]
我想根据添加日期对数组中的对象进行分组,即生成表单:
Item:[
[
{
product:"Shovel"
price: 100
dateAdded: 2018-11-28 18:28:12.356
}
{
product:"Wheel barrow"
price: 500
dateAdded: 2018-11-28 18:28:12.357
}
]
[
{
product:"Boot"
price: 500
dateAdded: 2018-11-29 18:29:12.357
}
]
]
关于使用 mongodb 进行聚合查询的任何想法
【问题讨论】:
标签: mongodb aggregation-framework