Mongodb – Error while changing the authentication – mongoDB

mongodb

I had database level authentication in mongoDB, I had tried to change the password for existing user. It is throwing not authorized error.

Steps i followed to change the password

use wallet
db.auth("username","password")
db.changeUserPassword("username","newpassword");

Error

Changing password failed: not authorized for update on wallet.system.users at src/mongo/shell/db.js:186

Any suggestion will be grateful.

Best Answer

You need to login and use ADMIN database to perform the operation.