Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-149

Some MongoDB 2.6 driver releases may not be able to add users or create indexes with mongos versions before 2.4.0

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: None
    • Labels:
      None
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      PYTHON-696 Done 2.7.1, 3.0
      PERL-336 Done 0.704.1.0
      RUBY-755 Done 1.10.1
      CDRIVER-362 Done
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion PYTHON-696 Done 2.7.1, 3.0 PERL-336 Done 0.704.1.0 RUBY-755 Done 1.10.1 CDRIVER-362 Done

      Drivers that implement DRIVERS-103 and/or DRIVERS-132 according to spec determine whether a command exists like so:

      try
          result = db.runCommand({<command>: ...})
      catch error
          if error code == 59 or error code == Null
              <fallback to existing code for backward compatibility>
          else
              re-raise error
      

      However, older mongos versions use code 13390 when a command is not found, so drivers throw an error instead of falling back to the legacy code path.

      This is a problem for all versions of mongos previous to 2.4.0:

      > db.version()
      1.8.0
      > db.runCommand("foobar")
      Thu May  1 13:07:55 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()
      1.8.5
      > db.runCommand("foobar")
      Thu May  1 13:10:00 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()           
      2.0.0
      > db.runCommand("foobar")
      Thu May  1 13:11:29 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()           
      2.0.9
      > db.runCommand("foobar")
      Thu May  1 13:13:07 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()           
      2.2.0
      > db.runCommand("foobar")
      Thu May  1 13:13:58 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()           
      2.2.7
      > db.runCommand("foobar")
      Thu May  1 13:14:51 uncaught exception: error { "$err" : "unrecognized command: foobar", "code" : 13390 }
      > db.version()                                  
      2.4.0
      > db.runCommand("foobar")                       
      { "ok" : 0, "errmsg" : "no such cmd: foobar" }
      > db.version()           
      2.4.10
      > db.runCommand("foobar")
      { "ok" : 0, "errmsg" : "no such cmd: foobar" }
      

      Note: This is not a problem for any version of mongod

      > db.version()
      1.8.0
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()
      1.8.5
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()           
      2.0.0
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()           
      2.0.9
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()           
      2.2.0
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()           
      2.2.7
      > 
      > db.runCommand("foobar")
      {
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	},
      	"ok" : 0
      }
      > db.version()           
      2.4.0
      > db.runCommand("foobar")
      {
      	"ok" : 0,
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	}
      }
      > db.version()           
      2.4.10
      > db.runCommand("foobar")
      {
      	"ok" : 0,
      	"errmsg" : "no such cmd: foobar",
      	"bad cmd" : {
      		"foobar" : 1
      	}
      }
      

            Assignee:
            barrie Barrie Segal
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: