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
Describe the bug
When fetching with populate and LoadStrategy.JOINED, a null relationship on the inverse side is populated as undefined instead of null even though I have forceUndefined set to false.
Expected behavior
It should be null instead of undefined.
Additional context
This is doesn't seem to happen with LoadStrategy.SELECT_IN. It also doesn't happen when I fetch directly from the entity User, only populating.
Versions
Dependency
Version
node
v18.12.0
typescript
4.6.4
mikro-orm
5.7.13
@mikro-orm/postgresql
5.7.13
The text was updated successfully, but these errors were encountered:
This is rather expected behavior, I will see if it can be fixed somehow, but you are probably getting undefined there because the value is not hydrated at all, not because it is hydrated to undefined - as opposed to using the select-in strategy where the value is hydrated to null which comes from the database.
If you want to speed things up, a complete repro is welcome.
Describe the bug
When fetching with
populate
andLoadStrategy.JOINED
, a null relationship on the inverse side is populated asundefined
instead ofnull
even though I haveforceUndefined
set to false.Example
User.ts
Profile.ts
Session.ts
Now if we have the following data in the db
users table
session table
profile table
Then we try to fetch Session populating User and its Profile:
We get
undefined
instead ofnull
Expected behavior
It should be null instead of undefined.
Additional context
This is doesn't seem to happen with
LoadStrategy.SELECT_IN
. It also doesn't happen when I fetch directly from the entity User, only populating.Versions
The text was updated successfully, but these errors were encountered: