This version of the documentation is archived and no longer supported.



db.changeUserPassword(username, password)

Updates a user’s password. Run the method in the database where the user is defined, i.e. the database you created the user.

Required Access

To modify the password of another user on a database, you must have the changeAnyPassword action on that database.


The following operation changes the password of the user named accountUser in the products database to SOh3TbYhx8ypJPxmt1oOfL:

use products
db.changeUserPassword("accountUser", "SOh3TbYhx8ypJPxmt1oOfL")