Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sequelize include - Don't include (remove) pivot data

I'm using the Sequelize package for node. I have a typical include on man to many relationship.

Item.findAll({
    include: {model: Blah: as 'blahs'}
});

All works well but it returns the set with the pivot data on each sub item. I don't need it. Is there any way to disable it or to specify the pivot fields needed?

like image 604
Rob Avatar asked Dec 24 '22 12:12

Rob


1 Answers

Found my answer:

{model: Model, as: 'model', through: {attributes: []}}
like image 188
Rob Avatar answered Dec 27 '22 04:12

Rob