Filter Records From Tables in Sequelize
Sequelize·2 min read·Jan 1, 2025
In Sequelize, the Op object provides a list of built-in operators, such as Op.eq for =, Op.and for AND, Op.between for BETWEEN ... AND ..., etc:
const { Op } = require('sequelize');To filter records based on conditions, you can use the where property combined with a built-in operator of the Op object:
{ where: { <attribute>: { [Op.<operator>]: <value> } }}Where:
attributeis the name of the column you want to perform a comparison of (e.g.,first_name).operatoris a built-in operator (e.g.,eq).valueis the value you want to compare the specified column to (e.g.,3).
Retrieve records in a list
Unlock the program 🚀
Pay once, own it forever.
€79
30-day money-back guarantee
- 13 modules
- 113 lessons with full-code examples
- 29 projects with commented solutions
- All future lesson and project updates
- Lifetime access
By submitting this form, you agree to the Terms & Conditions and Privacy Policy.