dropRole
On this page
Definition
dropRole
Deletes a user-defined role from the database on which you run the command.
The
dropRole
command uses the following syntax:{ dropRole: "<role>", writeConcern: { <write concern> }, comment: <any> } The
dropRole
command has the following fields:FieldTypeDescriptiondropRole
stringThe name of the user-defined role to remove from the database.writeConcern
documentOptional. The level of write concern for the operation. See Write Concern Specification.
comment
anyOptional. A user-provided comment to attach to this command. Once set, this comment appears alongside records of this command in the following locations:
mongod log messages, in the
attr.command.cursor.comment
field.Database profiler output, in the
command.comment
field.currentOp
output, in thecommand.comment
field.
A comment can be any valid BSON type (string, integer, object, array, etc).
New in version 4.4.
Required Access
You must have the dropRole
action on a database to drop a role from that database.
Example
The following operations remove the readPrices
role from the
products
database:
use products db.runCommand( { dropRole: "readPrices", writeConcern: { w: "majority" } } )