No role named readAnyDatabase

888 views
Skip to first unread message

Cedric MONCADE

unread,
Nov 24, 2014, 9:04:35 AM11/24/14
to mongo...@googlegroups.com
Hello,
I would like to add a role to my user on the local database in order to read the "oplog.rs" collection.
Here what I did:

> use <my_collection>
> db.grantRolesToUser("username",[{role:"readAnyDatabase",db:"local"}])

And I always have this message: "Error: No role named readAnyDatabase@local at src/mongo/shell/db.js:1237"

I don't understand what's going on,

Thanks

Andy Schwerin

unread,
Nov 24, 2014, 10:17:34 AM11/24/14
to mongo...@googlegroups.com
Cedric,

This list is intended for developers who write MongoDB, rather than users and developers who write software *using* MongoDB.  This question is more appropriate for the mongodb-users mailing list.

However, since you're already here, if I understand you correctly, you want to grant "username" the ability to read any collection on the "local" database.  That role is called "read", not "readAnyDatabase".  "readAnyDatabase" is a special role on the "admin" database that grants a user the ability to read any database at all, while "read" is a role on each database that allows a user to read all collections in that database.

I hope this helps.

-Andy

--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages