in sequelize how to get all? code example
Example 1: sequelize like search
const Sequelize = require('sequelize');
const Op = Sequelize.Op;
let data: Array<any> = await MyDataSequelizeAccess.findAll({
where: {
name: {
[Op.like]: '%Bob%'
}
}
});
Example 2: sequelize findall 2 attributes
Model.findAll({
attributes: [[sequelize.fn('COUNT', sequelize.col('hats')), 'no_hats']]
});