On this page本页内容
authenticate
¶Authenticates using the x.509 authentication mechanism. 使用x.509身份验证机制进行身份验证。When using the 使用mongo
shell, use the db.auth()
helper as follows:mongo
shell时,请使用db.auth()
助手,如下所示:
Tip
Starting in version 4.2 of the 从mongo
shell, you can use the passwordPrompt()
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. mongo
shell的4.2版开始,您可以将passwordPrompt()
方法与各种用户身份验证/管理方法/命令结合使用,以提示输入密码,而不是直接在方法/命令调用中指定密码。However, you can still specify the password directly as you would with earlier versions of the 但是,您仍然可以像使用早期版本的mongo
shell.mongo
shell一样直接指定密码。
In earlier versions, to use the 在早期版本中,使用db.auth()
method, specify the password:db.auth()
方法,指定密码:
Starting in MongoDB 4.2, if the client that issued the 从MongoDB 4.2开始,如果发出authenticate
disconnects before the operation completes, MongoDB marks the authenticate
for termination (i.e. killOp
on the operation).authenticate
的客户端在操作完成之前断开连接,MongoDB会将authenticate
标记为终止(即操作上killOp
)。