Using null inside an operator array for a sequelize query

Viewed 313

I am trying to simplify the following query (as shown in the docs):

const { Op } = require("sequelize");
User.findAll({
  where: {
    [Op.not]: [
      { email: '' },
      { email: null }
    ]
  }
});

to

const { Op } = require("sequelize");
User.findAll({
  where: {
    email: {
      [Op.not]: ['', null]
    }
  }
});

However, the two queries do not yield the same result. The latter yields an empty array. How can this be?

0 Answers
Related