How to use an include with attributes with sequelize?
Solution 1:
Something like this should work
foo.findAll({
where : where,
attributes : attributes,
include : [{ model: bar, attributes: attributes}]
}).success(function (result) {
Solution 2:
We can do something like that for exclude or include specific attribute with sequelize in Node.js.
Payment.findAll({
where: {
DairyId: req.query.dairyid
},
attributes: {
exclude: ['createdAt', 'updatedAt']
},
include: {
model: Customer,
attributes:['customerName', 'phoneNumber']
}
})