翻译或纠错本页面
- Reference >
- mongo Shell Methods >
- Role Management Methods >
- db.dropAllRoles()
db.dropAllRoles()¶
Definition¶
- db.dropAllRoles(writeConcern)¶
Deletes all user-defined roles on the database where you run the method.
警告
The dropAllRoles method removes all user-defined roles from the database.
The dropAllRoles method takes the following argument:
Field Type Description writeConcern document Optional. The level of write concern for the removal operation. The writeConcern document takes the same fields as the getLastError command. 返回: The number of user-defined roles dropped. The db.dropAllRoles() method wraps the dropAllRolesFromDatabase command.
Example¶
The following operations drop all user-defined roles from the products database and uses a write concern of majority.
use products
db.dropAllRoles( { w: "majority" } )
The method returns the number of roles dropped:
4