Grants roles to a user-defined role.
grantRolesToRolecommand has the following fields:
Field Type Description
string The name of a role to add subsidiary roles.
array An array of roles from which to inherit.
document Optional. The level of write concern for the modification. The
writeConcerndocument takes the same fields as the
To specify a role that exists in the same database where
grantRolesToRoleruns, you can either specify the role with the name of the role:
Or you can specify the role with a document, as in:
To specify a role that exists in a different database, specify the role with a document.
A role can inherit privileges from other roles in its database. A role created on the
admin database can inherit privileges from roles in any database.