how to authenticate user in mongodb


 description

Authenticate the admin user identity after passing through the mongo shell

 command

mongo
use admin
db.auth('username','password')

 parameter

auth(<username>, <password>) : Allow users to authenticate to the database from within the shell.

 result

1

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.