I’m getting an error when I try to verify a Gmail in MongoDB
function verify (email, callback) {
const MongoClient = require('mongodb@4.1.0').MongoClient;
const client = new MongoClient('mongodb+srv://<usernam>:<password>@cluster0.dcaauoo.mongodb.net/?retryWrites=true&w=majority');
client.connect(function (err) {
if (err) return callback(err);
const db = client.db('db-name');
const users = db.collection('users');
const query = { email: email, email_verified: false };
users.update(query, { $set: { email_verified: true } }, function (err, result) {
client.close();
if (err) return callback(err);
callback(null, result.result.n > 0);
});
});
}
In real code user and password have.