I am looking to pull items from a postgres data base with Sequelize, but only return items that have an id that does not equal any items in a given array.
In the Sequeli
using
const Op = Sequelize.Op
where: {
id: {[Op.notIn]:[1, 2, 3]}
}
See operators:
Sequelize exposes symbol operators that can be used for to create more complex comparisons
There exists $notIn, you must have missed it. Exemplary query with $notIn
generates
SELECT "id", "name"
FROM "categories" AS "Category"
WHERE "Category"."id" NOT IN (1, 2);
EDIT
The documentation you refer to is for 2.0
version of Sequelize, you should update to 3.0
.