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

"listCollections" command fails with BSONObjectTooLarge error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 5.0.15, 6.0.5
    • 7.0.0-rc0, 6.0.6, 5.0.17, 4.4.21, 6.3.1
    • None
    • None
    • Fully Compatible
    • ALL
    • v6.3, v6.0, v5.0, v4.4, v4.2
    • Hide

      (function() {
      "use strict";
       
      const validatorObj = {
      $jsonSchema: {
      bsonType: "object",
      properties: {
      s: {bsonType: "string", description: "x".repeat(4801)},
       
      }
      }
      };
       
      const nCollections = 3300;
      assert.commandWorked(db.dropDatabase());
      jsTestLog(`Creating ${nCollections} collections....`);
      for (let i = 0; i < nCollections; i++) {
      assert.commandWorked(db.createCollection("c_" + i.toPrecision(6), {"validator": validatorObj}));
      }
      jsTestLog(`Done creating ${nCollections} collections`);
      const res = db.runCommand({"listCollections": 1});
      assert.commandWorked(res);
      }());

      Show
      (function() { "use strict" ;   const validatorObj = { $jsonSchema: { bsonType: "object" , properties: { s: {bsonType: "string" , description: "x" .repeat( 4801 )},   } } };   const nCollections = 3300 ; assert .commandWorked(db.dropDatabase()); jsTestLog(`Creating ${nCollections} collections....`); for (let i = 0 ; i < nCollections; i++) { assert .commandWorked(db.createCollection( "c_" + i.toPrecision( 6 ), { "validator" : validatorObj})); } jsTestLog(`Done creating ${nCollections} collections`); const res = db.runCommand({ "listCollections" : 1 }); assert .commandWorked(res); }());
    • QE 2023-04-03

    Description

      "listCollections" command fails with BSONObjectTooLarge error when:

      1. the batch size is not specified or is large enough;
      2. the number of entries to return is larger than approximately 3300;
      3. total BSON size of entries to return approaches 16MB.

      Likely other commands such as "find" and "aggregate" are affected.

      Extremely likely the root cause is not accounting for array element field element size when building the result.

      Attachments

        Activity

          People

            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas (Inactive)
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: