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

Create collection command should check type of argument

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

      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@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: