sequelize like query code example
Example 1: sequelize order by
order: [["createdAt", "DESC"]]
Example 2: op in sequelize
//First method
// selecting authorityId :12 or 13
model.findAll({
where: {
[Op.or]: [
{ authorId: 12 },
{ authorId: 13 }
]
}
});
Example 3: sequelize like search
const Sequelize = require('sequelize');
const Op = Sequelize.Op;
let data: Array<any> = await MyDataSequelizeAccess.findAll({
where: {
name: {
[Op.like]: '%Bob%'
}
}
});
Example 4: sequelize .all()
yourTableModel.findAll({
//optional filters
where: {},
raw: true,
})