[SERVER-44957] Proposal: $find aggregation pipeline operator Created: 05/Dec/19 Updated: 06/Dec/22 Resolved: 05/Dec/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Pete Boere | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Participants: | |||||||||
| Description |
|
When filtering arrays we often need to reduce to the first element matching a condition. This is currently achievable with the following: {$project: { A cleaner and more performant option would be to have a dedicated `find` operator: {$project: { This idea is analagous to the ECMAScript Array.prototype.find, and would compliment the '$filter', '$map', and '$reduce' operators that are already implemented. |
| Comments |
| Comment by David Storch [ 05/Dec/19 ] |
|
Thanks for the feature request pete@duel.me! I'm closing this as a duplicate of SERVER-44441. Let us know if we missed something and you believe these two tickets are distinct. Best, |
| Comment by Carl Champain (Inactive) [ 05/Dec/19 ] |
|
Hi pete@duel.me, Thank you for the example. We're assigning this ticket to the Query team for further investigation. Updates will be posted on this ticket as they happen. Kind regards, |