On this page本页内容
dropUser
Removes the user from the database on which you run the command. 从运行命令的数据库中删除用户。The dropUser
command has the following syntax:dropUser
命令具有以下语法:
{ dropUser: "<user>", writeConcern: { <write concern> }, comment: <any> }
The dropUser
command document has the following fields:dropUser
命令文档包含以下字段:
dropUser | string | dropUser command while using the database where the user exists.dropUser 命令。
|
writeConcern | document |
|
comment | any |
|
Before dropping a user who has the 在删除具有userAdminAnyDatabase
role, ensure you have at least another user with user administration privileges.userAdminAnyDatabase
角色的用户之前,请确保至少有另一个具有用户管理权限的用户。
You must have the 必须对数据库执行dropUser
action on a database to drop a user from that database.dropUser
操作才能从该数据库中删除用户。
The following sequence of operations in mongosh
removes reportUser1
from the products
database:mongosh
中的以下操作序列从products
数据库中删除reportUser1
:
use products db.runCommand( { dropUser: "reportUser1", writeConcern: { w: "majority", wtimeout: 5000 } } )