Add roles to an existing user.
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