Can't exclude association's fields from select statement in sequelize
I realize this thread is a bit outdated, but since this is high in the Google search results and I struggled to find the answer myself, I thought I'd add this here.
If you're using Model.getAssociatedModel()
or Model.$get()
(for sequelize-typescript), the current answers listed will not work for this use case. In order to hide the model associations you need to add joinTableAttributes: []
Example:
Model.getAssociatedModel({ joinTableAttributes: []})
Example:
Model.$get('property', <any>{ joinTableAttributes: []});
At the time of this post, joinTableAttributes
is not included in the sequelize-typescript types hence the <any>