[SERVER-41077] Report an error sooner for $merge 'fail' modes Created: 09/May/19 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Anton Korshunov | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Participants: |
| Description |
|
The $merge stage performs an unordered update in batches. Each batch has a cap of either 16MB, or 100 000 update operations (which are not dynamically configurable). If we have a $merge stage with 'whenMatched=replaceWithNew whenNotMatched=fail' and updating 10 000 documents of 1KB each, and there is a single document without a match somewhere in the middle, we will still update all 10 000 documents minus 1, and raise an error only at the end. It would be much more preferable to error out as soon as we detect a document without a match. |