Sequelize.js: Query for not in array ($ne for items in array)

后端 未结 2 2019
悲哀的现实
悲哀的现实 2021-02-08 14:15

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

2条回答
  •  离开以前
    2021-02-08 15:12

    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.

提交回复
热议问题