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

autoIndexId not honored in mongo shell's createCollection command

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 1.8.1
    • 1.9.1
    • JavaScript, Shell
    • None
    • Ubuntu, Mac OS X
    • ALL

    Description

      DESCRIPTION

      Specifying autoIndexId : false while creating a capped collection from the JS mongo shell does not prevent creation of an index on _id.

      STEPS TO REPRODUCE

      $ mongo

      > use test
      > db.createCollection("mycoll",

      {size:10000000, autoIndexId:false}

      );

      { "ok" : 1 }

      > db.mycoll.getIndexes()
      [
      {
      "name" : "id",
      "ns" : "test.mycoll",
      "key" :

      { "_id" : 1 }

      ,
      "v" : 0
      }
      ]

      > db._dbCommand(

      {create:"mycoll2", size:10000000, autoIndexId:false}

      )

      { "ok" : 1 }

      > db.mycoll2.getIndexes()
      [ ]

      SUGGESTED RESOLUTION

      The current createCollection JS function does not copy the autoIndexId parameter from the passed-in opt object. If the parameter is set in opt, also set it in the cmd object.

      Current code:
      > db.createCollection
      function (name, opt) {
      var options = opt || {};
      var cmd =

      {create:name, capped:options.capped, size:options.size, max:options.max}

      ;
      var res = this._dbCommand(cmd);
      return res;
      }

      Attachments

        Issue Links

          Activity

            People

              antoine Antoine Girbal
              joachim@friend.ly Joachim
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: