You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't exclude association's fields from select statement in sequelize #3664
Reacted by Bogdan Polovko, Night Sun, Andhika Maheva Wicaksono, Jean, Franck Freiburger, Kimo, Cas Cornelissen, Nathan Mahdavi, Dmitry Shashkov, Saul Meneses and 45 more
Reacted by Pawel Halat, Mohannad Salah, Antonio Idalécio P. de Souza, V. Jenks and Odutola Kazeem
Reacted by Bogdan Polovko, Jean, justin.kruse, Pawel Halat, Vicente Guerra, Matt Ober, Pablo, Mohannad Salah, Antonio Idalécio P. de Souza, Hamza Hmem and 7 more
Reacted by kuubson, daronwolff and V. Jenks
Reacted by Nathan Mahdavi, Dmitry Shashkov, Pawel Halat, Kevin Angles, Mohannad Salah, Antonio Idalécio P. de Souza, Christian Lisangola, Hamza Hmem, Adam Mould, RamanZhukouski and 6 more
Define "doesn't work", what happens, what do you expect to happen, etc.
@mickhansenthrough: { attributes: [] } doesn't remove the join table fields from the SELECT. Tested with v4.37.6.
Reacted by Max Jacobson, Max Bogue, Derek Brooks, pavelpribysh, Joe Lafiosca, Sindhu, mookil, buidothanhvinh, bielavinvalentyn, Cole Jancsar and 2 more
yep! on polymorphic relationships, defining the empty through: { attributes: [] } property solves the problem in v4.38.0. it's not exactly intuitive... but it it works.
Reacted by Christianto Chen, Turtl3e, Pouya Emami, Santiago Ramirez, Cedric Simon, hyunjong lee, David NIVOT, Amaechi Chukwuebuka, Andrii Oriekhov, Ben and 4 more
Activity
mickhansen commentedon May 7, 2015
andrx commentedon May 7, 2015
Thank you! Couldn't find information about this in documentation though
janmeier commentedon May 7, 2015
@andrx its on the todo list :) #2975
GayathriMohan commentedon Oct 24, 2017
Is there any way I can exclude all the attributes in the model 'item' and just include the attributes present in the through model? @mickhansen
AntonAL commentedon Apr 10, 2018
@mickhansen, It does't work for "sequelize": "^4.37.4".
Is there some alternative?
My code is following:
mickhansen commentedon Apr 10, 2018
@AntonAL Define "doesn't work", what happens, what do you expect to happen, etc.
In any case i'm still using v3.
AntonAL commentedon Apr 10, 2018
@mickhansen See series of my last comments here #1897
danistefanovic commentedon Apr 24, 2018
@AntonAL Did you manage to make it work?
@mickhansen
through: { attributes: [] }doesn't remove the join table fields from the SELECT. Tested with v4.37.6.maxbogue commentedon May 22, 2018
This issue should be re-opened, as the provided solution no longer works.
dpkshrma commentedon Jun 16, 2018
@danistefanovic it worked for me in v4.37.10
through: { attributes: [] }removed the join table fields from the SELECTtry upgrading to the latest version
broox commentedon Aug 14, 2018
yep! on polymorphic relationships, defining the empty
through: { attributes: [] }property solves the problem inv4.38.0. it's not exactly intuitive... but it it works.e.g.
ryanburnette commentedon Nov 4, 2018
This is what I'm using for my use case where I want to exclude a field from the associated record.
wl1711 commentedon Nov 8, 2018
it doesn't work for me, I tried v 4.37.1, 4.38.0 and 4.41
opened another issue #10141
mookilyu commentedon May 16, 2019
How do this by
Model.getAssociatedModels()?MatheusJacob commentedon Jun 25, 2019
I couldn't make it work on getAssociateMOdels too...
jochri3 commentedon Jun 29, 2019
Thank you @mickhansen
Working Location Save
kuubson commentedon Jan 12, 2020
just use joinTableAttributes attribute
santiagoramirez commentedon Jun 15, 2020
@toxxiczny You're a life saver! This isn't even included in the types of sequelize-typescript, but works with an
as any.