问题
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?
回答1:
Found my answer:
{model: Model, as: 'model', through: {attributes: []}}
回答2:
It is not very clear what you are looking for but can you try adding raw:true
Item.findAll({
include: {model: Blah, raw: true}
});
can you post the result you got vs result you want
来源:https://stackoverflow.com/questions/33798994/sequelize-include-dont-include-remove-pivot-data