Eager Fetch Type On Association (ARCH3060)
Esta página aún no está disponible en tu idioma.
Key typescript.orm.eager-fetch-type-on-association · Severity warning · Category orm
Marking a relation always-eager at the mapping level (eager: true / fetch=EAGER) over-fetches the relation on every query of the owning entity. Choose eager loading per query instead.
Incorrect
Section titled “Incorrect”@Entity()export class Order { @OneToMany(() => LineItem, li => li.order, { eager: true }) items: LineItem[]; // loaded on every Order query}Correct
Section titled “Correct”@Entity()export class Order { @OneToMany(() => LineItem, li => li.order) items: LineItem[];}// When needed: orderRepo.find({ relations: { items: true } })Remove the always-eager mapping flag and eager-load the relation explicitly on the queries that need it.