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:
题目选项
- A.0
- B.2
- C.3
- 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),故置信度较低。