|
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"
|
}
|
|