-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.8, 2.5.4
-
Component/s: Querying
-
Fully Compatible
Observed behavior: The $mod query operator is excluded during index key matching.
Expected behavior: If a $mod query operator does not match an index key, the match is rejected before the document is loaded.
Test
> c.ensureIndex( { a:1 } ); > c.save( { a:0 } ); > c.save( { a:1 } ); > printjson( c.find( { a:{ $mod:[ 2, 0 ] } } ).hint( { a:1 } ).explain() ) { "cursor" : "BtreeCursor a_1", "isMultiKey" : false, "n" : 1, "nscannedObjects" : 2, // This is expected to be 1. "nscanned" : 2, "nscannedObjectsAllPlans" : 2, "nscannedAllPlans" : 2, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 0, "indexBounds" : { "a" : [ [ -1.7976931348623157e+308, 1.7976931348623157e+308 ] ] }, "server" : "Aaron-Staples-MacBook-Pro.local:27017" }
- depends on
-
SERVER-11817 refactor IndexBoundsBuilder to use an enum for exact/inexact rather than boolean
- Closed
- is related to
-
SERVER-11852 some regex queries have an unnecessary fetch
- Closed