authenticate
On this page本页内容
authenticate
-
Authenticates using the x.509 authentication mechanism.使用x.509身份验证机制进行身份验证。When using使用mongosh
, use thedb.auth()
helper as follows:mongosh
时,请按如下方式使用db.auth()
帮助程序:TipStarting in version 4.2 of the从mongoshell的4.2版本开始,您可以将mongo
shell, you can use thepasswordPrompt()
method in conjunction with various user authentication/management methods/commands to prompt for the password instead of specifying the password directly in the method/command call.passwordPrompt()
方法与各种用户身份验证/管理方法/命令结合使用来提示输入密码,而不是直接在方法/命令调用中指定密码。However, you can still specify the password directly as you would with earlier versions of the但是,您仍然可以像使用早期版本的mongo
shell.mongo
shell一样直接指定密码。db.auth( "username", passwordPrompt() )
In earlier versions, to use the在早期版本中,要使用db.auth()
method, specify the password:db.auth()
方法,请指定密码:db.auth( "username", "password" )
TipSee:请参阅:
Behavior行为
Client Disconnection客户端断开连接
Starting in MongoDB 4.2, if the client that issued 从MongoDB 4.2开始,如果在操作完成之前发出authenticate
disconnects before the operation completes, MongoDB marks authenticate
for termination using killOp
.authenticate
的客户端断开连接,MongoDB将使用killOp
标记authenticate
以终止。