No role named clusterAdmin

943 views
Skip to first unread message

Priya

unread,
Mar 9, 2016, 3:06:45 AM3/9/16
to mongodb-user
Im new to mongodb. im using mongodb 3.2. I need to monitor my mongodb operations for that the user need clusterAdmin privileges when i set db.grantRolesToUser("test123", [ { role: "clusterAdmin", db: "testdb" } ]) it showing error as Error: No role named clusterAdmin@testdb. What is my mistake?

Wan Bachtiar

unread,
Mar 9, 2016, 6:13:15 AM3/9/16
to mongodb-user

Hi Priya,

MongoDB provides the built-in database user and database administration roles on every database. The other built-in roles such as cluster administration, backup and restoration and all-database roles are only available on the admin database. See built-in roles for more details.

As per your example, you could modify testdb into admin:

db.grantRolesToUser("test123", [ { role: "clusterAdmin", db: "admin" } ])

You may also find Manage user and roles a useful read.

Kind regards,

Wan.

Reply all
Reply to author
Forward
0 new messages