typeorm
typeorm copied to clipboard
leftjoinandmapmany not returning all entities in case of multiple match
Issue description
i have Users, Files and UsersFiles join table in a many-to-many relation. The UsersFiles table can contain duplicates (userId,fileId) because there is a third column with a different "permission" value.
Expected Behavior
if i have this entries in the jointable:
{ userId: 1, fileId: 1, permission: "read"},{ { userId: 1, fileId: 1, permission: "write"},{ { userId: 1, fileId: 2, permission: "read"}
the leftjoinandmap operator loads only 2 entities and not the 3 of them, even if the actual raw results include 3 rows. ..
this is kinda bad TBH
Actual Behavior
see above
Steps to reproduce
see above
My Environment
postgresql
Additional Context
No response
Relevant Database Driver(s)
- [ ] aurora-mysql
- [ ] aurora-postgres
- [ ] better-sqlite3
- [ ] cockroachdb
- [ ] cordova
- [ ] expo
- [ ] mongodb
- [ ] mysql
- [ ] nativescript
- [ ] oracle
- [ ] postgres
- [ ] react-native
- [ ] sap
- [ ] spanner
- [ ] sqlite
- [ ] sqlite-abstract
- [ ] sqljs
- [ ] sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
@dberardo-com Share the code for more context.