MongoDB DBA · 题目 497 · 单选

14. Consider the following commands run in the mongo shell: db.createCollection( "signs", { "collation": { "locale": "fr" } } ) db.signs.createIndex( { "sign_text": 1 }, { "collation": { "locale": "es" } } ) db.signs.find( { "sign_text": "Bonjour Québec" } ) Which of the following statements is true about the final .find() commmand? Choose the best answer:

题目选项

  1. A.
    mongod will match documents using the French ("fr") collation.
  2. B.
    mongod will match documents using the Spanish ("es") collation.
  3. C.
    mongod will throw an error because the collection and the index have conflicting collations.
  4. D.
    mongod will throw an error because no collation was specified.
  5. E.
    mongod will match documents using either the French ("fr") or the Spanish ("es") collation.

答案置信度:高

正确答案:A

解析语言:中文

这次 find 没有显式指定 collation,就继承集合的默认 collation,即建集合时指定的 fr(法语),因此按法语规则比较,选 B。用 es 建的那个索引因为 collation 与查询不一致而不会被这次查询使用——不会报错,只是不走该索引,所以 A、C、D、E 都不对。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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