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

update command can make document larger than 16MB

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.6.0-rc2
    • 2.6.0-rc0
    • Write Ops
    • None
    • Fully Compatible
    • ALL
    • Hide

      var maxBsonObjectSize = db.isMaster().maxBsonObjectSize;
      var bigness = maxBsonObjectSize + 16261;
      var big_string = '';
       
      while (big_string.length < bigness) big_string += 'a';
       
      db.collection.drop();
      var result = db.runCommand({
          update: 'collection',
          ordered: true,
          updates: [
              {
                  q: {x: 1},
                  u: {$set: {s: big_string}},
                  multi: false,
                  upsert: true
              }
          ]
      });
       
      printjson(result);
      var overbigness = Object.bsonsize(db.collection.findOne()) - maxBsonObjectSize;
      print('made document ' + overbigness + ' bytes too big.')

      Show
      var maxBsonObjectSize = db.isMaster().maxBsonObjectSize; var bigness = maxBsonObjectSize + 16261; var big_string = '';   while (big_string.length < bigness) big_string += 'a';   db.collection.drop(); var result = db.runCommand({ update: 'collection', ordered: true, updates: [ { q: {x: 1}, u: {$set: {s: big_string}}, multi: false, upsert: true } ] });   printjson(result); var overbigness = Object.bsonsize(db.collection.findOne()) - maxBsonObjectSize; print('made document ' + overbigness + ' bytes too big.')

    Description

      The "update" command with "upsert: true" can make documents up to 16302 bytes larger than maxBsonObjectSize.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: