【发布时间】:2019-07-15 21:04:42
【问题描述】:
给定一个简单的Foo 实体,该实体又包含 mongodb 中 Bar 对象的集合
仅当列既是数组又是嵌入对象时才会出现问题。
@Entity()
export class Foo {
@ObjectIdColumn()
public id: ObjectID;
@Column()
public simple: string;
@Column(type => Bar)
public collection: Bar[];
}
export class Bar {
@Column()
value: boolean;
}
repository.create 转换原始值
{
"simple": "string",
"collection": [
{ "value": true },
{ "value": false }
]
}
进入简单
{ "simple": "string" }
我刚从https://github.com/typeorm/typeorm/issues/2342 拿了这个,但同样的事情发生在我身上
【问题讨论】:
-
还有问题吗?
标签: node.js mongodb typescript nestjs typeorm