Hello Friends,

Welcome To Infinitbility!

This article based on where or query in node sequelize, here you will get example of where or query.

Sequelize provide operator functionality to manage this types of query.

For using operator you have to import op from sequelize like below.

const { Op } = require("sequelize");

For using or condition we have to Op.or in where condition like below example.

const { Op } = require("sequelize");
Post.findAll({
  where: {
    [Op.or]: [
      { authorId: 12 },
      { authorId: 13 }
    ]
  }
});

Where or query output

// SELECT * FROM post WHERE authorId = 12 OR authorId = 13;

Thanks for reading…