【发布时间】:2023-01-12 21:00:21
【问题描述】:
我收集了一系列如下问题 -
{
question: "what's the question?",
answer: "some answer",
points: 10
},
{
question: "what's the question again?",
answer: "some answer again",
points: 40
},
...
已回答的问题将在其文档中包含 answer,反之亦然。我想使用 aggregate 将所有已回答和未回答的问题分组,以获得类似的输出 -
{
answered: [{...}, {...}],
unanswered: [{...}, {...}]
}
这个聚合查询会是什么样子?
【问题讨论】: