MikroORM Eager 设置为 false 但关系仍在加载
MikroORM Eager is set to false yet the relation is still being loaded
我有以下实体:
@Entity()
export class SomeEntity extends BaseEntity implements ISomeEntity {
@ManyToOne(() => OtherEntity, {
nullable: true,
eager: false
})
otherEntity: OtherEntity;
}
但是 otherEntity
在 运行 findOne
或 find
函数时仍然加载。
我不知道如何在不影响 where
条件的情况下停止加载其他关系。因为这会导致循环问题。
基于这里的装饰器https://mikro-orm.io/docs/decorators/#manytoone
eager boolean yes Always load the relationship.
显然在 MikroORM 中,它链接了之前自动加载的任何关系,而不管是否急切。这是设计使然。
我有以下实体:
@Entity()
export class SomeEntity extends BaseEntity implements ISomeEntity {
@ManyToOne(() => OtherEntity, {
nullable: true,
eager: false
})
otherEntity: OtherEntity;
}
但是 otherEntity
在 运行 findOne
或 find
函数时仍然加载。
我不知道如何在不影响 where
条件的情况下停止加载其他关系。因为这会导致循环问题。
基于这里的装饰器https://mikro-orm.io/docs/decorators/#manytoone
eager boolean yes Always load the relationship.
显然在 MikroORM 中,它链接了之前自动加载的任何关系,而不管是否急切。这是设计使然。