Type: New Feature
Resolution: Won't Fix
Priority: Major - P3
Affects Version/s: None
The isMaster command result contains two fields related to size:
- maxBsonObjectSize: the maximum size of a document that will be stored in a mongo collection.
- maxMessageSizeBytes: the maximum size of a wire protocol message
This is a request for a third:
- maxBsonWireObjectSize: the maximum size of a document not intended for storage that is included in a wire protocol message.
The reason this is necessary is that current drivers will not correctly send a command that includes a document that is close to the 16MB limit, because drivers apply maxBsonObjectSize to all documents, including command documents. Ao for example, most drivers will reject a findAndModify that contains a 16MB replacement document. With the new write commands, they will reject an insert of a 16MB document.
Looking at the server code, the current value of maxBsonWireObjectSize is 16MB + 16K:
Drivers can use this new field to impose a different limit on command documents than they impose on documents intended for storage. Without, they will have to hardcode the value in a constant, which is less than ideal, as it may change in the future.