I need to create a conditional in the query where if enabled = 1 or enabled = 2.
const existBusiness = await Business.findOne({
where: { id, enabled: 1, enabled: 2 },
});
For example:
if(enabled == 1 || enabled == 2)
I need to create a conditional in the query where if enabled = 1 or enabled = 2.
const existBusiness = await Business.findOne({
where: { id, enabled: 1, enabled: 2 },
});
For example:
if(enabled == 1 || enabled == 2)
const { Op } = require("sequelize");
const existBusiness = await Business.findOne({
where: {
[Op.or]: [
{enabled: 1},
{enabled: 2}
]
}
});
More information on Sequelize operators is available here.