authenticate
authenticate
- Authenticates using the x.509 authentication mechanism. When usingthe
mongo
shell, use thedb.auth()
helperas follows:
Tip
Starting in version 4.2 of the mongo
shell, you canuse the passwordPrompt()
method in conjunction withvarious user authentication/management methods/commands to promptfor the password instead of specifying the password directly in themethod/command call. However, you can still specify the passworddirectly as you would with earlier versions of themongo
shell.
- db.auth( "username", passwordPrompt() )
In earlier versions, to use the db.auth()
method, specifythe password:
- db.auth( "username", "password" )
See
db.auth()
and Securityfor more information.
Behavior
Client Disconnection
Starting in MongoDB 4.2, if the client that issued the authenticate
disconnects before the operation completes, MongoDB marksthe authenticate
for termination (i.e. killOp
on theoperation).