MongoDB: db.dropRole() method
db.dropRole()
The db.dropRole() method is used to delete a user-defined role from the database on which you run the method.
Syntax:
db.dropRole(rolename, writeConcern)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
rolename | The name of the user-defined role to remove from the database. | Required | string |
writeConcern | The level of write concern for the removal operation. The writeConcern document takes the same fields as the getLastError command. | Optional | document |
The db.dropRole() method wraps the dropRole command.
Example: MongoDB: db.dropRole() method
The following operations remove the myroll1 role from the payroll database:
use payroll
db.dropRole( "myroll1", { w: "majority" } )
Retrieve the restaurants data from here
Previous:
db.updateRole() method
Next:
db.dropAllRoles() 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://w3resource.com/mongodb/shell-methods/role-management/db-dropRole.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics