Skip to content

join exact columns #5445

Answered by B4nan
Laziz2L asked this question in Q&A
Apr 10, 2024 · 1 comments · 18 replies
Discussion options

You must be logged in to vote

Few notes:

  • your m:1 is virtual, that's your first issue, I guess you are coming from typeorm, seeing this entity definition? you don't need the scalar properties, but you need the relation ones, they define both the property value and the FK.
  • no point in adding persist: false on collection properties, they are virtual by definition
  • you need the Collection wrapper for them
  • you don't have to use the $and operator in join condition, just a plain object condition is enough - using $and/$or with a single item in the array makes no sense in general
  • the second approach is wrong, you need qb.joinAndSelect for hydration to work, you need the metadata which are otherwise not there, you need the al…

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@B4nan
Comment options

@Laziz2L
Comment options

@Laziz2L
Comment options

@B4nan
Comment options

Answer selected by Laziz2L
@B4nan
Comment options

@B4nan
Comment options

@Laziz2L
Comment options

@B4nan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants