[SERVER-10643] Document max document wire size in isMaster Created: 29/Aug/13  Updated: 26/Aug/19  Resolved: 07/Jan/14

Status: Closed
Project: Core Server
Component/s: Usability
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Greg Studer
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-3310 OP_QUERY bulk write should not batch ... Backlog
is related to SERVER-12275 Add MaxWriteBatchSize to isMaster res... Closed
Participants:

 Description   

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:

mongo/bson/util/builder.h:    const int BSONObjMaxInternalSize = BSONObjMaxUserSize + ( 16 * 1024 )

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.



 Comments   
Comment by Greg Studer [ 07/Jan/14 ]

Write commands are now bounded by the number of docs in the command and MaxBSONObjSize. As with other commands that act on documents, clients should assume the internal BSON size is large enough to handle the documents themselves plus the command overhead.

See SERVER-12275.

Generated at Thu Feb 08 03:23:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.