-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.4
-
Component/s: Sharding
-
None
-
Sharding
-
ALL
-
When I run the following mongo shell command against a mongos:
db.runCommand({$query:{usersInfo:1}, $readPreference:{mode: 'primary'}})
I get the response error:
{ "ok" : 0, "errmsg" : "\"$queryOptions\" is not a valid argument to usersInfo", "code" : 2, "codeName" : "BadValue" }
I have also observed similar behaviour in NODE-1012.
I do not get such an error when:
- Connecting to a standalone without auth enabled
{ "users" : [ ], "ok" : 1 }
- Connecting to a replica set primary or secondary(1) without auth enabled
{ "users" : [ ], "ok" : 1 }
- Connecting to a replica set primary or secondary(1) with auth enabled and not logged in
"errmsg" : "not authorized on test to execute command { usersInfo: 1.0} "
- Connecting to a replica set primary or secondary(1) with auth enabled and logged in with appropriate privileges, I get no error and a document containing a list of users and roles
{ "users" : [ { "_id" : "admin.limited", "user" : "limited", "db" : "admin", "roles" : [ { "role" : "readWrite", "db" : "food" }, { "role" : "read", "db" : "foo" } ] }, { "_id" : "admin.user", "user" : "user", "db" : "admin", "roles" : [ { "role" : "dbAdminAnyDatabase", "db" : "admin" }, { "role" : "readWriteAnyDatabase", "db" : "admin" }, { "role" : "userAdminAnyDatabase", "db" : "admin" }, { "role" : "clusterAdmin", "db" : "admin" } ] } ], "ok" : 1 }
(1) After the obligatory rs.slaveOk() of course.
- related to
-
COMPASS-1930 Connect To Secondary "not authorized" (possible regression)
- Closed
-
NODE-1012 MongoError: "$queryOptions" is not a valid argument to usersInfo
- Closed
-
SERVER-22516 mongos should apply client's read preference to all commands
- Backlog