looking at the docs you can use model.findAll({where: {attribute: x}})
. However, I want to select all attributes that are simply NOT x. I was looking into a regular expression here but that seemed like not an optimal solution.
What is the best way to do this?
In sql we use not equal to sign ( != ) but in sequelize we use Op.ne in query like below example.
findByPk() Finds a single active record with the specified primary key.
Updated method, for modern Sequelize:
model.findAll({ where: { someAttribute: { [sequelize.Op.not]: 'some value' } } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With