-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
SERVER-78260 was a bug related to "lifting" negation predicates outside of an $elemMatch. We appear to have solved this bug by making it so that $not under object $elemMatch cannot use an index, for example:
> db.foo.createIndex({"arr.b": 1}) > db.foo.find({arr: {$elemMatch: {b: {$ne: 1}}}}).explain() // collscan
It seems to me like this query could use this index (with a residual filter), the same way that the non-negated query can.
This ticket is to allow $not within an object $elemMatch to be able to use an index on the nested field. However, we should make sure not to re-introduce the bug fixed by SERVER-78260.
- is related to
-
SERVER-78260 Contained $or rewrite optimization incorrectly lifts a negation predicate outside an $elemMatch leading to missing query results
-
- Closed
-