-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.6.0
-
Component/s: Index Maintenance, Querying
-
None
-
ALL
-
ISSUE SUMMARY
When using $elemMatch on a compound multikey index, the result set is not always filtered correctly and may in certain edge cases return additional results that do not match the query. See the comments in this ticket for more details and an example.
USER IMPACT
Users affected by this bug may get query results that do not match the query predicate.
WORKAROUNDS
None.
RESOLUTION
The patch fixes a logical bug where $elemMatch expressions were not correctly handled. Specifically, the result set needs to be filtered to verify that the document correctly matches all predicates of the $elemMatch document.
AFFECTED VERSIONS
MongoDB version 2.6.0 is affected by this bug.
PATCHES
The patch is included in the 2.6.1 production release.
Original description
Looks like in 2.6 there is a bug when a complex index exists and you use a range query in the first part of the index.
I have tested this on 2.6.0 and 2.4.4. The bug does not exist on 2.4.4