【发布时间】:2020-03-12 04:18:00
【问题描述】:
我有一个聚合查询,它返回类似
的结果 {
count:1,
status: 'FAILED',
article_id: 1
},
{
count:1,
status: 'DELIVERED',
article_id: 1
}
我想按 article_id 分组并根据状态获取计数,如下所示:
{
article_id:1,
FAILED:1,
DELIVERED:2
}
我该如何存档? 提前致谢。
【问题讨论】:
标签: mongodb aggregation-framework