MongoDB: db.revokeRolesFromRole() method () method
db.revokeRolesFromRole()
The db.revokeRolesFromRole() method is used to remove inherited roles from a role.
Syntax:
db.revokeRolesFromRole( "<rolename>", [ <roles> ], { <writeConcern> } )
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
rolename | The name of the role from which to revoke roles. | Required | String |
roles | The inherited roles to remove. | Required | array |
writeConcern | The level of write concern to apply to this operation. The writeConcern document uses the same fields as the getLastError command. | Optional | document |
In the roles field, you can specify both built-in roles and user-defined role.
To specify a role that exists in the same database where db.revokeRolesFromRole() runs, you can either specify the role with the name of the role:
"readWrite"
Or you can specify the role with a document, as in:
{ role: "<role>", db: "<database>" }
To specify a role that exists in a different database, specify the role with a document.
Retrieve the restaurants data from here
Required Access
You must have the grantRole action on a database to grant a role on that database.
Previous:
db.grantPrivilegesToRole() method
Next:
db.grantRolesToRole() method
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mongodb/shell-methods/role-management/db-revokeRolesFromRole.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics