To connect to MongoDB and authenticate with Node.js, we call the authenticate
method.
For instance, we write
Db.authenticate(user, password, (err, res) => {
// callback
});
to call authenticate
with the user
username and password
to connect to the database with the credentials.
We get the result from the callback.