MongoDB DBA · 题目 378 · 单选

Consider the collection called travel that contains only the following 2 documents: { "_id" : ObjectId("5ab0615f5b3e785dd5fa3705"), "name" : "Randy Salazar", "age" : 60, "visited" : [ "Israel", "São Tomé and Príncipe", "Malta", "Ethiopia" ] } { "_id" : ObjectId("5ab0615f5b3e785dd5fa3706"), "name" : "Lillian Hernandez", "age" : 38, "visited" : [ "Canary Islands" ] } How many index entries will be created as a result of the following command? db.travel.createIndex({ visited: 1, age: 1 }) Choose the best answer:

题目选项

  1. A.
    0
  2. B.
    2
  3. C.
    3
  4. D.
    4 5 or more

答案置信度:低

正确答案:D

解析语言:中文

多键索引会为数组的每个元素各生成一条索引记录:Randy 的 visited 有 4 个元素(Israel、São Tomé and Príncipe、Malta、Ethiopia),配同一个 age=60 生成 4 条;Lillian 的 visited 只有 1 个元素,生成 1 条,合计 5 条,所以答案是"5 or more"。注意选项 D 的文本已损坏:"4" 与 "5 or more" 被粘在同一个选项里(按位置取 D),故置信度较低。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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