How to use an include with attributes with sequelize? How to use an include with attributes with sequelize? node.js node.js

How to use an include with attributes with sequelize?


Something like this should work

foo.findAll({    where      : where,    attributes : attributes,    include    : [{ model: bar, attributes: attributes}]}).success(function (result) {


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']    }})


Use the select without hyphen (-) only blank spaces like this.

Model.find().select('attr1 attr2 attr3')