- Reference >
mongoShell Methods >- User Management Methods >
- db.dropAllUsers()
db.dropAllUsers()¶
On this page
Definition¶
-
db.dropAllUsers(writeConcern)¶ Removes all users from the current database.
Warning
The
dropAllUsersmethod removes all users from the database.The
dropAllUsersmethod takes the following arguments:Field Type Description writeConcerndocument Optional. The level of write concern for the removal operation. The writeConcerndocument takes the same fields as thegetLastErrorcommand.The
db.dropAllUsers()method wraps thedropAllUsersFromDatabasecommand.
Example¶
The following db.dropAllUsers() operation drops every user from
the products database.
use products
db.dropAllUsers( {w: "majority", wtimeout: 5000} )
The n field in the results document shows the number of users
removed:
{ "n" : 12, "ok" : 1 }