Reputation: 1639
I just upgraded to 2.6. I run the authSchemaUpgrade
. But after that, I managed to remove all users from the database (Its a private small database, so that is nothing too bad). Now I have created a new user admin
:
{
"_id" : "admin.admin",
"user" : "admin",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
After I have db.auth("admin","..")
on the admin database I should be able to query any other databases too, but after I do:
user otherDatabase show collections
I get:
2014-06-09T09:33:36.853+0000 error: {
"$err" : "not authorized for query on otherDatabase.system.namespaces",
"code" : 13
} at src/mongo/shell/query.js:131
What am I missing?
Upvotes: 0
Views: 57
Reputation: 9507
You need to give your admin user the role readWriteAnyDatabase
in order to allow that user to query other databases.
You may want to also consider giving your admin user dbAdminAnyDatabase
and clusterAdmin
roles.
Upvotes: 1