To make Sequelize OR query with Node.js, we call findAll
with an object with the where
property.
For instance, we write
Post.findAll({
where: {
authorId: {
[Op.or]: [12, 13],
},
},
});
to call findAll
with an object to query the Post
items with authorId
equal to 12 or 13, which is
SELECT * FROM post WHERE authorId = 12 OR authorId = 13;