Sequelize error when using “where” and “in” on a subarray

前端 未结 5 1630
一整个雨季
一整个雨季 2021-02-02 06:22

This is my model definition:

var Tag = sequelize.define(\'Tag\', {
    name: Sequelize.STRING
});

var Event = sequelize.define(\'Event\', {
    name: Sequelize.         


        
5条回答
  •  [愿得一人]
    2021-02-02 06:45

    in property able to use at version 4.42

    Tag.findAll({
        where: { id: {in: [1,2,3,4]} }
    }).then(...)
    

    And you can use notIn property for excluded values.

    Tag.findAll({
        where: { id: {notIn: [1,2,3,4]} }
    }).then(...)
    

    http://docs.sequelizejs.com/manual/querying.html#operators

提交回复
热议问题