Verify email script works while with the try option, but does not work on live version

Hello I have implemented a verify script for my custom mongoDB, every script works except verify email script. When I use the try button provided it says that it is succesful, but when I try it on my live version React app, the email does not become verified and I get an error.
I have provided the error I get and my script

  function verify (email, callback) {
  const MongoClient = require('mongodb@3.1.4').MongoClient;
  const client = new MongoClient('mongodb+srv://',  { useNewUrlParser: true });

  client.connect(function (err) {
    if (err) return callback(err);

    const db = client.db('test');
    const users = db.collection('TestCollection');
    const query = { email: email, email_verified: false };

    users.update(query, { $set: { email_verified: true } }, function (err, count) {

      if (err) return callback(err);
      callback(null, count > 0);

Description: User account does not exist or verification code is invalid.

I know the user is in my database I have seen it, but it does not have the email_verified attribute with him, is it because of that?

1 Like