-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
This query:
find({$expr: { $in: ["$_id", [1, 2]]}})
... doesn't use an index.
If I expand the $in to $or and $eq, though, it uses the index:
find({$expr: { $or: [{$eq: ["$_id", 1]}, {$eq: ["$_id", 2]}]}})
This seems like something the server could gainfully do internally to avoid a collection scan.
- duplicates
-
SERVER-32549 allow $expr with $in expression use a non-multikey index
- Open
- related to
-
SERVER-32549 allow $expr with $in expression use a non-multikey index
- Open