Create collection command should check type of argument

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Currently assumes it is a string without checking. This causes the following commands to treat garbage memory as strings. I haven't been able to crash the server with this, but I do get some odd collection names:

      > db.runCommand(

      {create:true}

      )

      { "ok" : 1 }

      > db.runCommand(

      {create:null}

      )

      { "ok" : 1 }

      > db.createCollection() // same as

      {create:undefined} { "ok" : 1 }

      > show tables
      Status // from create:true
      n( // from create: null
      ped // from createCollection()

      see attached one-line patch for an easy fix which gives a helpful message:

      > db.createCollection()
      {
      "errmsg" : "exception: must pass name of collection to create",
      "code" : 15888,
      "ok" : 0
      }

            Assignee:
            Mathias Stearn
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: