MongoDB DBA · 题目 543 · 多选

3. Which of the following is true about the $group Aggregation Framework stage? Check all that apply:

题目选项

  1. A.
    If null is pasted to _id parameter in the $group stage then all documents will be placed in a single new group.
  2. B.
    The $group stage can only be used once in an Aggregation pipeline.
  3. C.
    Accumulator expressions can be used in the $group stage.
  4. D.
    The _id parameter in the $group stage is how incoming documents are grouped in this stage.

答案置信度:高

正确答案:A、C、D

解析语言:中文

$group 的 _id 就是分组键,_id 为 null 时所有输入文档进入同一个组(A、D 正确);累加器表达式($sum、$avg、$push 等)只能出现在 $group 阶段(C 正确)。B 错:一个聚合管道里可以多次使用 $group(例如先按天分组再按月分组)。

所在套题

此题在题库中有 1 条记录。公开详情合并相同题干和选项;完整公开题展示置信度最高的一条记录,其他题目仅展示摘要。按套学习保留每条记录原有的答案、解析和置信度。

作者 · 作品 · 开源

作者与 MongoDB 作品

专注数据平台、MongoDB 迁移同步与云运维产品研发。

有任何 MongoDB 需求,均可联系作者。

联系作者 ↗mlhp123@outlook.com

支持作者

如果题库对您有帮助,欢迎自愿扫码打赏。

支付宝扫码打赏作者打开打赏原图 ↗