Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Duplicate
-
2.6.4
-
None
-
None
Description
Why can't $elemMatch be used in the $project phase? It would allow me to easily select an element out of an array.
Example:
db.person.aggregate([
|
{ "$project": {'main_event' :
|
{'$events_array': {'$elemMatch' : {
|
'event_status' : 'main'
|
}}}
|
}}
|
]);
|
Basically what I'm looking for is an easier way to convert an array into a scalar without having to $unwind and then re-$group, which is taxing for proc time.
Attachments
Issue Links
- duplicates
-
SERVER-17943 add $filter expression to $project to work with $map and $reduce
-
- Closed
-