TypeORM CheatsheetMon Jan 03 2022
TypeORM
Relationships
When querying for entities you can request associated entities that the parent entity has a relationship with.
`await UserEntity.find({relations: ["homes"]});`
If `homes` also has a relationship that should be returned
`await UserEntity.find({relations: ["home", "home.address"]});`
Tips
How to use joins with .find(...)
link
To add a limit to a find(
request, add the keyword take:
)
When creating a nullable entity, the variable needs to be nullable too
@Column({ type: String, nullable: true })
token: string | null;