Enable new kinds of updates by exposing aggregation expressions in a command which performs updates.
This improvement will be useful to implement custom logic to merge conflicting documents during an aggregation outputting to an existing collection. This was originally part of PM-828, but moved out of scope. For example:
- Incrementally add counts to a rollup summary table which was previously computed. Imagine a collection 'events.monthly_summaries' which holds one document per month summarizing all events hosted within the month. After each event, you wish to increment the total number of registrations for the current month without changing any of the other statistics for that month.
- Maintain a single view of a customer after ingesting updates from other collections or systems. Once a week, you wish to scrape all new customer interactions for any updated contact info and save/merge that info into a collection which represents all known contact info for a customer. Specifically, you may want to add any new addresses to a set of known addresses.