12. 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:
题目选项
- A.shard0001
- B.shard0000
- C.shard0003
- D.shard0004
- E.shard0002
答案置信度:低
正确答案:A、B、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);选项顺序在不同真题文档里被打乱过,务必以位置为准。