Details
Description
> db.c.insert({a: [1, 2]})
|
WriteResult({ "nInserted" : 1 })
|
> db.c.find({a: {$lte: [0, 0]}})
|
> db.c.find({a: {$lte: [2, 2]}})
|
{ "_id" : ObjectId("5dfa766b191cd168059aaf54"), "a" : [ 1, 2 ] }
|
> db.c.createIndex({a: 1})
|
{
|
"createdCollectionAutomatically" : false,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
> db.c.find({a: {$lte: [2, 2]}})
|
>
|
The bounds we build for this look wrong:
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.c",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"a" : {
|
"$lte" : [
|
2,
|
2
|
]
|
}
|
},
|
"queryHash" : "811451DD",
|
"planCacheKey" : "B859B02A",
|
"winningPlan" : {
|
"stage" : "FETCH",
|
"filter" : {
|
"a" : {
|
"$lte" : [
|
2,
|
2
|
]
|
}
|
},
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"a" : 1
|
},
|
"indexName" : "a_1",
|
"isMultiKey" : true,
|
"multiKeyPaths" : {
|
"a" : [
|
"a"
|
]
|
},
|
"isUnique" : false,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"a" : [
|
"[[], [ 2.0, 2.0 ]]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"serverInfo" : {
|
"host" : "borosaurus",
|
"port" : 30000,
|
"version" : "4.2.1",
|
"gitVersion" : "edf6d45851c0b9ee15548f0f847df141764a317e"
|
},
|
"ok" : 1
|
}
|
It only includes arrays! Since we index arrays element-wise, this will miss results.
Attachments
Issue Links
- is duplicated by
-
SERVER-26655 $gt operation on array with index
-
- Closed
-
- related to
-
SERVER-49766 Indexed and non-indexed collections return different results for null query
-
- Closed
-
-
SERVER-47382 Enable $not with arrays
-
- Closed
-