sequelize limit column value code example
Example 1: sequelize limit
const Op = Sequelize.Op;
app.get('/notes/search', function(req, res) {
Note.findAll({
limit: 2,
where: {
tag: {
[Op.or]: [].concat(req.query.tag)
}
}
}).then(notes => res.json(notes));
});
Example 2: count in sequelize example
exports.getItemSaleCount = () => SaleItem.findAll({ attributes: ['itemId', [sequelize.fn('count', sequelize.col('itemId')), 'count']], group : ['SaleItem.itemId'], raw: true, order: sequelize.literal('count DESC') });