10334 — BSONObjectTooLarge
writestorage
The document exceeds the maximum BSON size (16 MB)
What is happening?
BSONObjectTooLarge is returned when a document exceeds the 16 MB BSON size limit. This limit applies to the final serialised BSON document, including all fields, subdocuments, and arrays. It is checked during inserts, updates (if the result document would exceed the limit), and when building command responses. The 16 MB limit is a fundamental MongoDB constraint and cannot be changed.
Common causes
- Unbounded array growth (e.g. pushing items to an array without limit)
- Storing large binary data (images, files) directly in a document
- Deeply nested subdocuments accumulating over time
- Aggregation $group accumulating a result larger than 16 MB
- find or aggregate response containing a single document exceeding the limit