getRole( rolename, args )
Returns the roles from which this role inherits privileges. Optionally, the method can also return all the role’s privileges.
db.getRole()method accepts the following parameters:
Parameter Type Description
string The name of the role.
document Optional. A document specifying additional arguments.
argsdocument supports the following fields:
Field Type Description
boolean Optional. When the
rolesInfofield is set to
trueto include built-in roles in the output. By default this field is set to
false, and the output for
rolesInfo: 1displays only user-defined roles.
boolean Optional. Set the field to
trueto show role privileges, including both privileges inherited from other roles and privileges defined directly. By default, the command returns only the roles from which this role inherits privileges and does not return specific privileges.