MongoDB DBA · Question 378 · Single choice

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:

Answer options

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

Answer confidence: Low

Correct answer: D

Explanation language: Chinese

多键索引会为数组的每个元素各生成一条索引记录: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),故置信度较低。

Papers containing this question

This question appears in 2 bank records. Public pages combine identical prompts and options. Selected questions display the highest-confidence record; the others show a short preview. Paper-based learning preserves each record's answer, explanation, and confidence.

AUTHOR · PROJECTS · OPEN SOURCE

Author & MongoDB projects

Building data platforms, MongoDB migration and sync tools, and cloud operations products.

Contact the author for any MongoDB needs.

Contact the author ↗mlhp123@outlook.com

Support the author

If this question bank helps you, optional donations are welcome.

Scan with Alipay to support the authorOpen full-size donation image ↗