On this page本页内容
db.
dropUser
(username, writeConcern)¶Removes the user from the current database.从当前数据库中删除用户。
The db.dropUser()
method takes the following arguments:db.dropUser()
方法采用以下参数:
username |
string | |
writeConcern |
document | writeConcern document takes the same fields as the getLastError command.writeConcern 文档采用与getLastError 命令相同的字段。 |
The db.dropUser()
method wraps the dropUser
command.db.dropUser()
方法包装dropUser
命令。
Before dropping a user who has the 在删除具有userAdminAnyDatabase
role, ensure you have at least another user with user administration privileges.userAdminAnyDatabase
角色的用户之前,请确保至少有另一个具有用户管理权限的用户。
If run on a replica set, 如果在副本集上运行,默认情况下,db.dropUser()
is executed using majority
write concern by default.db.dropUser()
将使用majority
写入关注点执行。
You must have the 要从数据库中删除用户,必须对数据库执行dropUser
action on a database to drop a user from that database.dropUser
操作。
The following 下面的db.dropUser()
operation drops the reportUser1
user on the products
database.db.dropUser()
操作会将reportUser1
用户删除到products
数据库中。