This version has reached end of life on October 2016. Learn more about upgrading your version of MongoDB.



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

You must have the changeAnyPassword action on a database to modify the password of any user on that database.

To change your own password, you must have the changeOwnPassword action on your database. See Change Your Password and Custom Data.


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

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