grantRolesToRole(rolename, roles, writeConcern?)
This method takes three parameters. This method grants roles to a user-defined role.
Syntax:
db.grantRolesToUser( "<rolename>", [ <roles> ], { <writeConcern> })
Example:
use admin
db.grantRolesToRole(
"myAdmin",
[ "read" ],
{ w: "majority" , wtimeout: 5000 }
)
MongoDB
db.grantRolesToRole("myAdmin",[ "read" ],{ w: "majority" , wtimeout: 5000 })
No comments:
Post a Comment