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

autoIndexId not honored in mongo shell's createCollection command

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.9.1
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Environment:
      Ubuntu, Mac OS X
    • Operating System:
      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

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

                Dates

                Created:
                Updated:
                Resolved: