I've created these two users in my admin database:
db.auth('admin','password')
1
> db.getUsers()
[
{
"_id" : "admin.siteUserAdmin",
"user" : "siteUserAdmin",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
},
{
"_id" : "admin.admin",
"user" : "admin",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
]
I am uthenticated correctly from my localhost, but when I try to use an external client to get connected to my database I got this error:
Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document
How do I fix it?
As stated here: MongoDB 3 authentication mechanism has been changed from MongoDB Challenge and Response (MONGODB-CR) to challenge and response mechanism (SCRAM-SHA-1).
You have to delete your created user then change admin.system.version.authSchema to 3 instead of 5. Then recreating your user should solve the problem:
var schema = db.system.version.findOne({"_id" : "authSchema"})
schema.currentVersion = 3
db.system.version.save(schema)
This link might be helpful too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With