- Reference >
mongoshMethods >- User Management Methods >
- db.dropAllUsers()
db.dropAllUsers()¶
On this page
Definition¶
-
db.dropAllUsers(writeConcern)¶ Removes all users from the current database.
Warning
The
db.dropAllUsersmethod removes all users from the database.The
db.dropAllUsersmethod takes the following arguments:Field Type Description writeConcerndocument Optional. The level of write concern for the operation. See Write Concern Specification. The
db.dropAllUsers()method wraps thedropAllUsersFromDatabasecommand.
Behavior¶
Replica set¶
If run on a replica set, db.dropAllUsers() is executed using
"majority" write concern by default.
Example¶
The following db.dropAllUsers() operation drops every user from
the products database.
The n field in the results document shows the number of users
removed: