Help Center/ Document Database Service/ FAQs/ Database Permissions/ User Management/ Deleting a User
Updated on 2025-07-30 GMT+08:00
Deleting a User
db.dropUser(username, writeConcern)
- username is the name of the user to be deleted from the database.
- writeConcern: The level of write concern for the removal operation. This parameter is optional.
Example
The following describes how to delete user reportUser1 from database products.
use products
db.dropUser("reportUser1", {w: "majority", wtimeout: 5000}) After the user is deleted, null is displayed when you run the db.getUser command.
replica:PRIMARY> db.getUser("reportUser1")
null Parent topic: User Management
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.