MongoDB DBA · 题目 425 · 单选

58. Consider the following query: db.movies.find( {"countries.0": "France", "genres.0": "Documentary"}, {"countries":1, "genres":1, "title":1, "year":1, "_id":0} ) Choose the best answer:

题目选项

  1. A.
    { "genres" : [ "Documentary", "History", "Music" ], "title" : "Woodstock", "year" : 1970, "countries" : [ "USA" ] }
  2. B.
    { "_id" : ObjectId("573a1399f29313caabcedc24"), "genres" : [ "Documentary" ], "title" : "It's All True", "year" : 1993, "countries" : [ "France", "USA" ] }
  3. C.
    { "genres" : [ "Documentary" ], "title" : "Nanook of the North", "year" : 1922, "countries" : [ "USA", "France" ] }
  4. D.
    { "genres" : [ "Documentary" ], "title" : "F for Fake", "year" : 1973, "countries" : [ "France", "Iran", "West Germany" ] }

答案置信度:高

正确答案:D

解析语言:中文

countries.0 与 genres.0 只匹配数组的第一个元素,因此文档必须满足 countries[0]="France" 且 genres[0]="Documentary",D 正确(投影里有 _id:0,输出不应出现 _id)。B 仍然输出了 _id,直接排除;A 的 countries[0] 是 USA、C 的 countries[0] 也是 USA,都不满足条件。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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