[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 Created: 01/May/14  Updated: 15/Apr/19  Resolved: 04/Mar/15

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-362 mongos can return error 13390 for unk... Closed
depends on PYTHON-696 Index and user manipulation broken wi... Closed
depends on RUBY-755 Index and user creation broken with m... Closed
Related
related to DRIVERS-103 Manipulate user objects exclusively v... Closed
related to CXX-189 Add Create Index Helper Closed
related to DRIVERS-132 Use createIndexes command when available Closed
Driver Compliance:
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

 Description   

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
	}
}


Generated at Thu Feb 08 08:20:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.