-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Component/s: None
-
None
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 } }
- depends on
-
CDRIVER-362 mongos can return error 13390 for unknown command
- Closed
-
PYTHON-696 Index and user manipulation broken with mongos versions before 2.4.0
- Closed
-
RUBY-755 Index and user creation broken with mongos versions before 2.4.0
- Closed
- related to
-
DRIVERS-103 Manipulate user objects exclusively via commands
- Closed
-
CXX-189 Add Create Index Helper
- Closed
-
DRIVERS-132 Use createIndexes command when available
- Closed