sequelize where more than code example

Example 1: op in sequelize

//First method
// selecting authorityId :12 or 13
model.findAll({
  where: {
    [Op.or]: [
      { authorId: 12 },
      { authorId: 13 }
    ]
  }
});

Example 2: sequelize where more than

// Number comparisons
      [Op.gt]: 6,                              // > 6
      [Op.gte]: 6,                             // >= 6
      [Op.lt]: 10,                             // < 10
      [Op.lte]: 10,                            // <= 10
      [Op.between]: [6, 10],                   // BETWEEN 6 AND 10
      [Op.notBetween]: [11, 15],               // NOT BETWEEN 11 AND 15

Example 3: op in sequelize

// second method
// selecting authorityId :12 or 13
model.findAll({
  where: {
    authorId: {
      [Op.or]: [12, 13]
    }
  }
});

Tags:

Misc Example