-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
For performance reasons, you would generally decide to use $in in scenarios where they apply over $or.
However, some scenarios apply that you would be forced to use a $or in order to add more complex clauses or ranges to your query. For something like find all values of a where a > 10 and a < 20 or a > 30 and a < 50, you would be forced to use a $or query even though the only field being used in the index is a.
$or should be able to detect when it does not need to run as multiple queries and perhaps handle single field cases like this in a performant way.
- duplicates
-
SERVER-12024 re-implement $in in terms of $or
- Backlog