NobleUplift
NobleUplift

Reputation: 6034

Why is the Op.not operator no longer working in Sequelize 4.41.0?

I recently upgraded many of the packages in my project, and since I did, the following query now fails:

query['where'] = { [Op.and]: [
        sequelize.where(Database.getInstance().getConnection().col('id'), '!=', jsonObject['id'] ),
        sequelize.where(Database.getInstance().getConnection().col('username'), jsonObject['username'])
]};
console.log('Check if username is unique...');
console.log(query);

It results in:

 Unhandled rejection Error: Invalid value Where {
   attribute: Col { col: 'id' },
   comparator: '=',
   logic: { [Symbol(not)]: 1563 } }
   attribute: Col { col: 'id' },

I also tried:

query['where'] = { [Op.and]: [
    sequelize.where(Database.getInstance().getConnection().col('id'), '!=', jsonObject['id'] ),
    sequelize.where(Database.getInstance().getConnection().col('username'), jsonObject['username'])
]};

While following the docs, but it still resulted in an error:

Unhandled rejection Error: Invalid value Where { attribute: Col { col: 'id' }, comparator: '!=', logic: 1563 }

Upvotes: 1

Views: 402

Answers (0)

Related Questions