Authentication Mechanisms
Note
Starting in version 4.0, MongoDB removes support for the deprecated
MongoDB Challenge-Response (MONGODB-CR
) authentication mechanism.
MongoDB supports the following authentication mechanisms:
SCRAM (Default)
In addition, MongoDB Enterprise provides integration with a number of external authentication mechanisms, including Kerberos and LDAP. See Enterprise Authentication Mechanisms for the additional authentication mechanisms supported by MongoDB Enterprise.
Default Authentication Mechanism
As of MongoDB 3.0, Salted Challenge Response Authentication Mechanism (SCRAM) is the default authentication mechanism for MongoDB.
Specify Authentication Mechanism
To specify the authentication mechanism to use, set the
authenticationMechanisms
parameter for mongod
and
mongos
.
Clients specify the authentication mechanism in the db.auth()
method.
For the mongo
shell and the MongoDB tools, you can also specify the
authentication mechanism from the command line.