-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.7.6
-
Component/s: Index Maintenance
-
None
-
Environment:Linux Ubuntu 64 bit
-
ALL
Queries can return different results depending on whether an index exists or not, when Indexing on lists.
It is best illustrated with code:
> db.test.insert(
{a:[1,1,1]})
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.find(
{'a.0':1})
{ "_id" : ObjectId("4d60ceef276d207f24f8c3b2"), "a" : [ 1, 1, 1 ] } { "_id" : ObjectId("4d60cef1276d207f24f8c3b3"), "a" : [ 1, 1, 2 ] } { "_id" : ObjectId("4d60cef2276d207f24f8c3b4"), "a" : [ 1, 1, 3 ] } { "_id" : ObjectId("4d60cef9276d207f24f8c3b5"), "a" : [ 1, 2 ] } { "_id" : ObjectId("4d60cf04276d207f24f8c3b6"), "a" : [ 1, 2, 1 ] }Unless you add an index:
> db.test.ensureIndex(
)
> db.test.find(
)
Same query now returns nothing. Returning nothing is probably what is expected in this case.
- duplicates
-
SERVER-2902 Index keys are not generated for numerically referenced array elements
- Closed
- is depended on by
-
SERVER-44393 indexu.js fails in replica_set_passthrough when two phase index builds are enabled
- Closed