MongoDB DEV · 题目 63 · 单选

Consider the following query: db.movies.find( {"countries.0": "France", "genres.0": "Documentary"}, {"countries":1, "genres":1, "title":1, "year":1, "_id":0} ) Which of the following documents could be returned by this query: Choose the best answer:

题目选项

  1. A.
    { "genres" : [ "Documentary" ], "title" : "F for Fake", "year" : 1973, "countries" : [ "France", "Iran", "West Germany" ] }
  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", "History", "Music" ], "title" : "Woodstock", "year" : 1970, "countries" : [ "USA" ] }

答案置信度:高

正确答案:A

解析语言:中文

"countries.0"/"genres.0" 是按数组下标做的等值匹配:要求 countries 的第一个元素是 France、genres 的第一个元素是 Documentary。投影里写了 _id:0,因此返回文档不能含 _id,只有 A 同时满足(B 带 _id 与投影矛盾,C 的 countries[0] 是 USA,D 的 countries 只有 USA)。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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