【发布时间】:2022-01-16 23:55:03
【问题描述】:
我有一个像这样的对象
{
name: 'abc',
value: BigNumber('125'),
other: {
otherValue: BigNumber('252'),
}
}
它的猫鼬模式是:
{
name: { type: String, required: true },,
value: { type: String, required: true },,
other: {
otherValue: { type: String, required: true },,
}
}
有没有办法在存储对象之前自动将value 和otherValue 解析为字符串(通过调用.toString()),或者唯一的方法是手动解析?
【问题讨论】:
标签: typescript mongoose