-
Type:
Bug
-
Resolution: Done
-
Priority:
Critical - P2
-
None
-
Affects Version/s: 3.0.0
-
Component/s: None
-
Environment:Windows 10, x64
I have a database with a collection 'institutions'. It has a field with an array of tuples: 'institutions.person_id_role_id'. Each tuple is a pair of ObjectIds pointing to the collection 'person' and 'role', respectively.
The following expression works well:
db.getCollection('institutions').find({ "person_id_role_id" : { "$elemMatch" : { "0" : {$eq:ObjectId("59bec3d719f9d536a018438e")}}}});
After I index parts of the array of pairs:
db.getCollection('institutions').ensureIndex(
);
db.getCollection('institutions').ensureIndex(
);
... the upper expression does not work anymore. If I delete the index, it works again.
I feel as if something is wrong here. Perhaps the indexing does not resolve ".0" correctly (sometimes meaning first array pair, and sometimes meaning left part of the pair in the array).
Please help! How would you solve this?