[SandboxUnhandledError] Cannot read properties of undefined (reading 'n')

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.

Hi @abdur258rahman258

Welcome to the Auth0 Community!

Thank you for posting your question. I noticed that your inquiry is related explicitly to MongoDB, which falls outside the scope of Auth0 support. While we aim to assist with all things related to Auth0, questions about MongoDB might be better addressed by experts in that field.

I would recommend visiting the MongoDB Community Forum at MongoDB Community, where a dedicated community of MongoDB users and experts can provide more targeted advice

If you have any Auth0 related questions in the future, please feel free to reach out. We’re always here to help with any Auth0 related queries or issues you might encounter.

Thanks
Dawid

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.