翻译或纠错本页面
- Reference >
- mongo Shell Methods >
- User Management Methods >
- db.dropUser()
db.dropUser()¶
Definition¶
- db.dropUser(username, writeConcern)¶
Removes the user from the current database.
The db.dropUser() method takes the following arguments:
Parameter Type Description username string The name of the user to remove from the database. writeConcern document Optional. The level of write concern for the removal operation. The writeConcern document takes the same fields as the getLastError command. The db.dropUser() method wraps the dropUser command.
Example¶
The following db.dropUser() operation drops the accountAdmin01 user on the products database.
use products
db.dropUser("accountAdmin01", {w: "majority", wtimeout: 5000})