-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.6.2
-
Component/s: Index Maintenance
-
None
-
ALL
Problem:
A different number of documents are returned if an array is indexed or not.
Reproduce:
> db.perm.save(
{ what : "1", permissions : [ "perm-access-help" ] })
> db.perm.save(
)
> db.perm.save(
)
> db.perm.save(
)
> db.perm.save(
)
Query with out the index, returns four documents
> db.perm.find( { permissions :
} )
{ "_id" : ObjectId("4cb64a7540292d4539c3ceeb"), "what" : "1", "permissions" : [ "perm-access-help" ] } { "_id" : ObjectId("4cb64a8040292d4539c3ceec"), "what" : "2", "permissions" : [ "perm-access-admin-area" ] } { "_id" : ObjectId("4cb64a8b40292d4539c3ceed"), "what" : "3", "permissions" : [ "perm-access-admin-area", "perm-access-help" ] } { "_id" : ObjectId("4cb64aa140292d4539c3ceef"), "what" : "5" }Adding the index returns 5 documents
> db.perm.ensureIndex(
)
> db.perm.find( { permissions :
} )
{ "_id" : ObjectId("4cb64a9940292d4539c3ceee"), "what" : "4", "permissions" : [ ] } { "_id" : ObjectId("4cb64aa140292d4539c3ceef"), "what" : "5" } { "_id" : ObjectId("4cb64a8040292d4539c3ceec"), "what" : "2", "permissions" : [ "perm-access-admin-area" ] } { "_id" : ObjectId("4cb64a8b40292d4539c3ceed"), "what" : "3", "permissions" : [ "perm-access-admin-area", "perm-access-help" ] } { "_id" : ObjectId("4cb64a7540292d4539c3ceeb"), "what" : "1", "permissions" : [ "perm-access-help" ] }Business Case:
- reliability
The behavior of the query should not change depending on whether an index is present or not.
- is depended on by
-
SERVER-3375 key generation fixes master ticket
- Closed