On this page
db.dropAllRoles()
在本页面
Definition
db.
dropAllRoles
(* writeConcern *)- 删除运行该方法的数据库上的所有user-defined角色。
Warning
dropAllRoles
方法从数据库中删除* all * user-defined个角色。
dropAllRoles
方法采用以下参数:
Field | Type | Description |
---|---|---|
writeConcern |
document | 可选的。删除操作的write concern级别。 writeConcern 文档具有与getLastError命令相同的字段。 |
Returns: | user-defined个角色已删除。 |
---|
db.dropAllRoles()方法包装dropAllRolesFromDatabase命令。
Behavior
Replica set
如果在副本集上运行,默认情况下将使用majority写关注来执行db.dropAllRoles()。
Required Access
您必须在数据库上具有dropRole action才能从该数据库中删除角色。
Example
以下操作从products
数据库中删除所有user-defined角色,并使用majority
的write concern。
use products
db.dropAllRoles( { w: "majority" } )
该方法返回删除的角色数:
4