Database Manual / Reference / mongosh Methods / User Management

db.removeUser() (mongosh method方法)

Deprecated since version 2.6自2.6版本起已弃用: Use db.dropUser() instead of db.removeUser():使用db.dropUser()代替db.removeUser()

Definition定义

db.removeUser(username)

Removes the specified username from the database.从数据库中删除指定的用户名。

The db.removeUser() method has the following parameter:db.removeUser()方法有以下参数:

Parameter参数Type类型Description描述
usernamestring字符串The database username.数据库用户名。

Compatibility兼容性

This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:

Important

This command is not supported in MongoDB Atlas clusters. MongoDB Atlas集群不支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本