On this page本页内容
dropAllRolesFromDatabase Deletes all user-defined roles on the database where you run the command.删除运行命令的数据库中所有用户定义的角色。
The dropAllRolesFromDatabase removes alluser-defined roles from the database.dropAllRolesFromDatabase从数据库中删除所有用户定义的角色。
The dropAllRolesFromDatabase command takes the following form:dropAllRolesFromDatabase命令采用以下形式:
{
dropAllRolesFromDatabase: 1,
writeConcern: { <write concern> },
comment: <any>
}
The command has the following fields:该命令包含以下字段:
dropAllRolesFromDatabase | integer | 1 to drop all user-defined roles from the database where the command is run. 1可从运行命令的数据库中删除所有用户定义的角色。 |
writeConcern | document | /includes/source/fact-write-concern-spec-link.rst |
comment | any |
|
You must have the 必须对数据库执行dropRole action on a database to drop a role from that database.dropRole操作才能从该数据库中删除角色。
The following operations drop all user-defined roles from the 以下操作将从products database:products数据库中删除所有用户定义的角色:
use products
db.runCommand(
{
dropAllRolesFromDatabase: 1,
writeConcern: { w: "majority" }
}
)
The 结果文档中的n field in the results document reports the number of roles dropped:n字段报告丢弃的角色数:
{ "n" : 4, "ok" : 1 }