MongoDB DBA · 题目 59 · 单选

59. Consider the following query: db.movies.aggregate([ { $lookup: { from: "cinemas", localField: "theater", foreignField: "movie", as: "theater_shows" } } ]) If this query is run against a sharded collection, where will the $lookup aggregation stage take place? Choose the best answer:

题目选项

  1. A.
    A random shard
  2. B.
    The primary shard
  3. C.
    The mongos
  4. D.
    The shard containing the most movies documents
  5. E.
    Each individual shards

答案置信度:高

正确答案:B

解析语言:中文

含 $lookup 的聚合不能把归并放在 mongos:官方规定 $lookup、$out 这类阶段的合并部分在集合的 primary shard 上执行,因此该 $lookup 在 primary shard 上完成(B)。C 是本题最有迷惑性的选项——不含 $lookup/$out 的普通管道归并才发生在 mongos,所以 D、E、A 均不成立。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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