sequelize-typescript icon indicating copy to clipboard operation
sequelize-typescript copied to clipboard

Association N:M

Open jsanz1209 opened this issue 3 years ago • 1 comments

Hi everyone,

I'm trying to define an association N:M, I mean, I have a table A, another one B and another C, whose primary keys are are related with A and B.

I'm trying to make a query for getting all data of table A including in a array the data collection of the table B related with the table A, but I've not been able of getting all these data. This should be easy through a library as sequelize.

I've tested with belongsToMany but only I've got the data of table A repeated several times once by each association with the Table C.

Can someone help me with this problem? Thanks in advance.

jsanz1209 avatar Sep 13 '22 20:09 jsanz1209

If you don't get all the data from the relationship table, then the problem is that sequelize filters out duplicates, even though, for example, I have a third field in the relationship table with different options, which is exactly what I need to get. I did not find how to disable this filtering. Sequelize developers please take this into consideration.

OleksaGit avatar Oct 18 '23 11:10 OleksaGit