|
When $merge or $out has to issue a remote write and needs to serialize a write batch to BSON, it can fail with a BSONObjectTooLarge error. In the past, this was because we were incorrectly computing the size of each insert/update statement (see SERVER-66289 and SERVER-74806 for more details). Nowadays, this can still occur if the size of a single write plus the size of the impersonation metadata and the write header size (that is, the fields outside of the individual write statements themselves) exceeds the BSONObj size limit. Though this is correct behavior, it isn't helpful for a user to see a BSONObjectTooLarge error as it doesn't give them any clue as to what could be going wrong. This ticket tracks the work to emit a more descriptive error message when DocumentSourceWriter fails in this way.
|