MongoDB Documentation, Release 3.0.4 Step 2: Create a role with appropriate privileges. In the admin database, create a new role with changeOwnPassword (page 419) and changeOwnCustomData (page 419). Step 3: Add a user with this role. In the test database, create a new user with the created "changeOwnPasswordCustomDataRole" role. For example, the following operation creates a user with both the built-in role readWrite (page 406) and the user-created "changeOwnPasswordCustomDataRole" . To grant an existing user the new role, use db.grantRolesToUser() . Step 1: Connect with the appropriate privileges. Connect to the mongod or mongos as a user with appropriate privileges. For example, the following operation connects to MongoDB as user123 created in the Prerequisites (page 396) section. To check that you have the privileges specified in the Prerequisites (page 396) section as well as to see user information, use the usersInfo command with the showPrivileges option. mongo --port 27017 -u user123 -p 12345678 --authenticationDatabase test Step 2: Change your password and custom data. Use the db.updateUser() method to update the password and custom data. For example, the following operation changes thw user’s password to KNlZmiaNUp0B and custom data to { title: "Senior Manager" } : 397 6.3. Security Tutorials use test db.updateUser( "user123", { pwd: "KNlZmiaNUp0B", customData: { title: "Senior Manager" } use test db.createUser( { user:"user123", pwd:"12345678", roles:[ "readWrite", { role:"changeOwnPasswordCustomDataRole", db:"admin" } ] } ) use admin db.createRole( { role: "changeOwnPasswordCustomDataRole", privileges: [ { resource: { db: "", collection: ""}, actions: [ "changeOwnPassword", "changeOwnCustomData" ] } ], roles: [] } ) Procedure