-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
Currently $elemMatch can only be applied to an array. For example { a:{ $elemMatch:{ $gte:1, $lte:10 } } } will match { a:[ 5 ] } but not { a:5 }. This is a bit awkward in a case like { 'a.b':{ $elemMatch:{ $gte:1, $lte:10 } } } and a document { a:[ { b:5 }, { b:15 } ] }. The document will not match because the b values are not arrays, even though there could be multiple values of 'a.b'.
- duplicates
-
SERVER-15086 Allow for efficient range queries over non-array fields in multikey indices
- Closed
- is duplicated by
-
SERVER-5320 Make $elemMatch support single object
- Closed
- is related to
-
SERVER-1264 $elemMatch on subArray
- Closed
- related to
-
SERVER-7959 Potentially unexpected scans with compound indexes when some fields are multikey
- Closed
-
SERVER-47925 Add a new $elemMatch-like operator which matches both arrays and scalars
- Backlog