AuthenticationFailed MONGODB-CR credentials missing in the user document

Error Description: When you are using MongoDB 3.0 and decide to use MONGODB-CR as password authentification mechanism instead of the default SCRAM-SHA-1 (or maybe MONGODB-CR is not your choice but is your legacy PHP/Java/Ruby driver support), the new user you create don’t have MONGODB-CR credentials as expected:

use admin
db.system.users.findOne({user: “”admin”,”})
{
“_id” : “admin.admin”,
“user” : “admin”,
“db” : “admin”,
“credentials” : {
“SCRAM-SHA-1″ : {
“iterationCount” : 10000,
“salt” : “FPnmqmCI04KHJVZunfaI2Q==”,
“storedKey” : “i+jvORcFsnx6CXt0Bd924e2f804=”,
“serverKey” : “PQHG8nYYcJTjFEClqjFRZ8PTLTA=”
},
“MONGODB-CR” : “8aab8902fd862afad8064b73bd149d00″
},
“roles” : [
{
“role” : “userAdminAnyDatabase”,
“db” : “admin”
}
]
}

Cause: authSchemaVersion is set  to “5” and only SCRAM credentials will be generated in MongoDB 3.0:

use admin
db.system.version.find()
{ “_id” : “authSchema”, “currentVersion” : 5 }

Solution: Restart mongod/mongos while disable –auth, then change authSchemaVersion to “3” to support MONGODB-CR. See https://jira.mongodb.org/browse/SERVER-17459

use admin
db.system.version.update({ “_id” : “authSchema”},{$set: {“currentVersion” : 3} })

AuthenticationFailed MONGODB-CR credentials missing in the user document