Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1189

Allow command documents to exceed maxBsonObjectSize

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: Command Operations
    • None

      Several commands, e.g. findAndModify, may be used to insert or replace a document that is up to the exact 16MB max BSON object size. MongoDB servers allow this, and therefore should be allowed by the driver for.

      Currently however the extra surrounding "envelope" bytes of the message cause the total payload size to exceed 16MB, tripping the OutMessage validation.

      Example stack trace:

      com.mongodb.MongoInternalException: DBObject of size 16777340 is over Max BSON size 16777216
          at com.mongodb.OutMessage.putObject(OutMessage.java:291)
          at com.mongodb.OutMessage.writeQuery(OutMessage.java:211)
          at com.mongodb.OutMessage.query(OutMessage.java:84)
          at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:285)
          at com.mongodb.DB.command(DB.java:262)
          at com.mongodb.DB.command(DB.java:229)
          at com.mongodb.DB.command(DB.java:214)
          ...
      

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

              Created:
              Updated:
              Resolved: