Complete the code to specify the authentication mechanism when connecting to MongoDB.
mongo --username user --password pass --authenticationMechanism [1]
The SCRAM-SHA-256 mechanism is a common and secure authentication method used in MongoDB.
Complete the code to create a user with SCRAM-SHA-1 authentication mechanism in MongoDB.
db.createUser({user: 'alice', pwd: 'secret', roles: ['readWrite'], [1]: ["SCRAM-SHA-1"]})The correct field to specify the authentication mechanism when creating a user is mechanisms.
Fix the error in the connection string to use the correct authentication mechanism.
mongodb://user:pass@host:27017/db?authMechanism=[1]
Using SCRAM-SHA-256 is recommended as it is more secure than SCRAM-SHA-1.
Fill both blanks to configure MongoDB to use X.509 certificate authentication.
mongo --host [1] --ssl --sslPEMKeyFile [2] --authenticationMechanism MONGODB-X509
The host should be the MongoDB cluster address, and the PEM key file is the certificate file path.
Fill all three blanks to create a user with LDAP authentication and assign the read role.
db.createUser({user: '[1]', roles: ['[2]'], [3]: ["PLAIN"]})The user name is 'ldapUser', the role is 'read', and the authentication mechanism key is mechanisms with value ['PLAIN'] for LDAP.