Section: Users and roles

Grant additional roles

javascript
javascript
db.grantRolesToUser("appuser", [{ role: "dbAdmin", db: "appdb" }])
Explanation

Roles can be layered as responsibilities change.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Users and roles
Create a user
Create a database user with roles.
OpenIn sheetjavascriptsame section
Show users
List users in the current database.
OpenIn sheetjavascriptsame section
Change a user password
Rotate a database credential.
OpenIn sheetjavascriptsame section
Drop a user
Remove a user account.
OpenIn sheetjavascriptsame section
Check server status
Inspect a detailed server-status document.
OpenIn sheetjavascript1 tag match
Inspect current operations
See active operations on the server.
OpenIn sheetjavascript1 tag match