【发布时间】:2021-01-07 22:59:31
【问题描述】:
我将 typeorm 中的实体定义为:
@Entity('foo', { schema: 'dbo' })
export class Foo extends BaseEntity {
...
@ManyToMany(() => Bar, (bar) => bar.some, { lazy: true })
bars: Promise<Bar[]>
}
当我使用 find 时,结果显示为下划线,而不是普通对象 (bars):
const results = await Foo.find({ relations: ['bars'] });
results.__bars__ // <--------- this should be just `bars`.
这是 typeorm 的正常行为吗?如果不是如何解决?
【问题讨论】:
标签: javascript node.js typescript typeorm