sequelize query as code example
Example 1: op in sequelize
//First method
// selecting authorityId :12 or 13
model.findAll({
where: {
[Op.or]: [
{ authorId: 12 },
{ authorId: 13 }
]
}
});
Example 2: sequelize get where
// Example
const Tokens = db.define('tokens', {
guid: {
type: sequelize.STRING
}
});
// The basics of Sequelize Get Where
Tokens.findAll({
where: { guid: 'guid12345' }
}).then(tokens => {
console.log(tokens);
}).catch(err => console.log('error: ' + err));;
// is equal to >> SELECT * FROM Tokens WHERE guid = 'guid12345'