How to use operators in your Sequelize queries

When you use the Sequelize ORM for your JavaScript project, the SQL operators are included in the library in the form of the Op object.

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

When you call the query methods from your model, you can use the Op object properties to create SQL queries with operators.

for example,

User.findAll({
  where: {
    firstName: {
      [Op.like]: "John",
    },
  },
});

Sequelize provides several operators.

Leave a comment

Your email address will not be published. Required fields are marked *