Details
-
Bug
-
Resolution: Duplicate
-
Major - P3
-
None
-
3.2.12
-
None
-
Fully Compatible
-
ALL
-
Description
The data:
MongoDB Enterprise > db.coll2.find()
|
{ "_id" : ObjectId("58e6cf4badef354b4b538a00"), "name" : "jam", "a" : { "b" : [ 1 ], "c" : [ 11 ] } }
|
{ "_id" : ObjectId("58e6cf77adef354b4b538a01"), "name" : "jam", "a" : { "b" : [ 2, 3 ] } }
|
{ "_id" : ObjectId("58e6cf83adef354b4b538a02"), "name" : "jam", "a" : { "c" : [ 12 ] } }
|
{ "_id" : ObjectId("58e6cfb6adef354b4b538a03"), "name" : "jam", "a" : { "c" : [ ] } }
|
{ "_id" : ObjectId("58e6cfbdadef354b4b538a04"), "name" : "jam", "a" : { "b" : [ ] } }
|
{ "_id" : ObjectId("58e700b8adef354b4b538a05"), "name" : "jam2" }
|
{ "_id" : ObjectId("58e701edadef354b4b538a06"), "name" : "jam3", "a" : 34 }
|
{ "_id" : ObjectId("58e70244adef354b4b538a07"), "name" : "jam3", "a" : { "b" : 34 } }
|
The indexes:
MongoDB Enterprise > db.coll2.getIndexes()
|
[
|
{
|
"v" : 1,
|
"key" : {
|
"_id" : 1
|
},
|
"name" : "_id_",
|
"ns" : "test.coll2"
|
},
|
{
|
"v" : 1,
|
"key" : {
|
"a.b.0" : 1
|
},
|
"name" : "a.b.0_1",
|
"ns" : "test.coll2"
|
},
|
{
|
"v" : 1,
|
"key" : {
|
"a.c.0" : 1
|
},
|
"name" : "a.c.0_1",
|
"ns" : "test.coll2"
|
}
|
]
|
WRONG Result of search (looking non empty array entr(ies) in the indexed sub-documents) :
MongoDB Enterprise > db.coll2.find({$or :[{"a.b" : {$gt : []}}, {"a.c" :{$gt : []}}] })
|
MongoDB Enterprise >
|
The results returns 0 entries.
If remove the indexes using db.coll2.dropIndexes() and conduct the search again I get the RIGHT result as :
MongoDB Enterprise > db.coll2.find({$or :[{"a.b" : {$gt : []}}, {"a.c" :{$gt : []}}] })
|
{ "_id" : ObjectId("58e6cf4badef354b4b538a00"), "name" : "jam", "a" : { "b" : [ 1 ], "c" : [ 11 ] } }
|
{ "_id" : ObjectId("58e6cf77adef354b4b538a01"), "name" : "jam", "a" : { "b" : [ 2, 3 ] } }
|
{ "_id" : ObjectId("58e6cf83adef354b4b538a02"), "name" : "jam", "a" : { "c" : [ 12 ] } }
|
Attachments
Issue Links
- duplicates
-
SERVER-26655 $gt operation on array with index
-
- Closed
-