-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Labels:None
-
Query Execution
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.