MongoDB DBA · 题目 279 · 多选

57. Suppose you have a sharded collection called products with the following chunk ranges: { "productId" : { "$minKey" : 1 } } -->> { "productId" : 9294 } on : shard0000 { "t" : 2, "i" : 0 } { "productId" : 9294 } -->> { "productId" : 18684 } on : shard0002 { "t" : 3, "i" : 0 } { "productId" : 18684 } -->> { "productId" : 27851 } on : shard0003 { "t" : 4, "i" : 0 } { "productId" : 27851 } -->> { "productId" : 36852 } on : shard0004 { "t" : 5, "i" : 0 } { "productId" : 36852 } -->> { "productId" : 46047 } on : shard0005 { "t" : 6, "i" : 0 } { "productId" : 46047 } -->> { "productId" : 55450 } on : shard0006 { "t" : 7, "i" : 0 } { "productId" : 55450 } -->> { "productId" : 64644 } on : shard0007 { "t" : 8, "i" : 0 } { "productId" : 64644 } -->> { "productId" : 73769 } on : shard0000 { "t" : 9, "i" : 0 } { "productId" : 73769 } -->> { "productId" : 82950 } on : shard0002 { "t" : 10, "i" : 0 } { "productId" : 82950 } -->> { "productId" : 91983 } on : shard0001 { "t" : 10, "i" : 1 } { "productId" : 91983 } -->> { "productId" : { "$maxKey" : 1 } } on : shard0001 { "t" : 1, "i" : 10 } Which shards would be involved in answering the following query? db.products.find({ "$or": [ { "productId" : { "$gte": 91983 }, { "productId": { "$lt": 18684 } } } ] }) Check all that apply:

题目选项

  1. A.
    shard0002
  2. B.
    shard0003
  3. C.
    shard0001
  4. D.
    shard0004
  5. E.
    shard0000

答案置信度:低

正确答案:A、C、E

解析语言:中文

题干里的 $or 在源文档转录时已损坏(数组里只有一个元素,且同一对象里出现了无名字段),按 MongoDB 原题应理解为 $or:[{productId:{$gte:91983}},{productId:{$lt:18684}}],解析结论才是确定的。按此语义:$gte 91983 命中 [91983,maxKey) → shard0001;$lt 18684 命中 [minKey,9294) → shard0000 与 [9294,18684) → shard0002。因此涉及 shard0002、shard0001、shard0000(A、C、E);选项顺序在不同真题文档里被打乱过,务必以位置为准。

所在套题

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

作者 · 作品 · 开源

作者与 MongoDB 作品

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

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

联系作者 ↗mlhp123@outlook.com

支持作者

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

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