The new version has canceled the AddUser method, use the CreateUser method
Official address: https://docs.mongodb.com/manual/tutorial/create-users/
Official address: https://docs.mongodb.com/manual/reference/command/createUser/#dbcmd. CreateUser
Role permissions: https://docs.mongodb.com/manual/reference/built-in-roles/#built-in-roles
Db.createuser ({ User:' user ', pwd:' passwd ', roles:["Dbadminanydatabase", "Readwriteanydatabase"]})
The new version uses the Scram-sha-1 authentication method by default, and this error is encountered when connecting to MONGO:
Error: Failed to authenticate *@* with mechanism MONGODB-CR:AUTHENTICATIONFAILED:MONGODB-CR credentials missing in the user Document
> Use Admin
Switched to DB admin
var schema = Db.system.version.findOne ({"_id": "Authschema"}) >schema.currentversion = 3 3> Db.system.version.save (Schema)
Users who cannot log on need to remove the re-add
"MongoDB" MongoDB 3.2 scram-sha-1 authentication method