Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10643

Document max document wire size in isMaster

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Usability
    • 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:

      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.

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: