Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
Execution Team 2021-11-15, Execution Team 2021-11-29
Description
If we perform the following query, the results of the find().hint().min().max() query includes every record, instead of min inclusive and max exclusive like standard index behavior
// suppose we have documents {_id: 0} .... {_id: 100}
|
....,
|
const cmd: {
|
find: collName,
|
min: {_id: 3},
|
max: {_id: 4},
|
hint: {_id: 1},
|
},
|
const explain = assert.commandWorked(coll.runCommand({explain: cmd}));
|
// we expect the nReturned to be 1 (doc {_id: 3}), however, nReturned = 100 |
This is because we bypass accounting for min() / max() if the hint matches the cluster key.
While using $lt(e)/$gte in a filter already works with $hint, min/max is handled differently internally.
Attachments
Issue Links
- is depended on by
-
SERVER-60123 Support using clusterKey {_id : 1} for shardKey in a sharded collection
-
- Closed
-