[SOLVED] Sequelize select * where attribute is NOT x

Issue

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?

Solution

Try this

model.findAll({where: {attribute: { $not: 'x'}}})

Sequelize actually provides many operators for you to get your filter data.

You can refer to the link here

Answered By – Eunice Poh

Answer Checked By – Marie Seifert (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *