On this page本页内容
dropAllUsersFromDatabase Removes all users from the database on which you run the command.从运行命令的数据库中删除所有用户。
The dropAllUsersFromDatabase removes all users from the database.dropAllUsersFromDatabase从数据库中删除所有用户。
The dropAllUsersFromDatabase command has the following syntax:dropAllUsersFromDatabase命令具有以下语法:
{ dropAllUsersFromDatabase: 1,
writeConcern: { <write concern> },
comment: <any>
}
The dropAllUsersFromDatabase document has the following fields:dropAllUsersFromDatabase文档包含以下字段:
dropAllUsersFromDatabase | integer | 1 to drop all the users from the current database.1以从当前数据库中删除所有用户。 |
writeConcern | document |
|
comment | any |
|
You must have the 必须对数据库执行dropUser action on a database to drop a user from that database.dropUser操作才能从该数据库中删除用户。
The following sequence of operations in mongosh drops every user from the products database:mongosh中的以下操作顺序将每个用户从产品数据库中删除:
use products
db.runCommand( { dropAllUsersFromDatabase: 1, writeConcern: { w: "majority" } } )
The 结果文档中的n field in the results document shows the number of users removed:n字段显示删除的用户数:
{ "n" : 12, "ok" : 1 }