-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Fully Compatible
-
ALL
When searching for an empty array if we match on "undefined" in the index we can use the index to find them. Also, searching for $size:0 could also be re-written to the empty array, and use the same bounds.
Currently searching for an empty array with an index on the array does this:
// 2.4.x find({a:[]}).explain() { "cursor" : "BtreeCursor a_1 multi", "isMultiKey" : false, "n" : 1, "nscannedObjects" : 1, "nscanned" : 1, "nscannedObjectsAllPlans" : 1, "nscannedAllPlans" : 1, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 0, "indexBounds" : { "a" : [ [ null, null ], [ [], [] ] ]}} // 2.5.5--pre (12/11/13) { "cursor" : "BtreeCursor a_1", "isMultiKey" : false, "n" : 1, "nscannedObjects" : 2, "nscanned" : 2, "nscannedObjectsAllPlans" : 4, "nscannedAllPlans" : 4, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 1, "nChunkSkips" : 0, "millis" : 2, "indexBounds" : { "a" : [[{ "$minElement" : 1 }, { "$maxElement" : 1 }]]}}
- duplicates
-
SERVER-10026 New query system
- Closed