model 字段定义
market_prices: {
type: Schema.Types.Mixed,
required: false,
default: {},
}
尝试更新字段的值
运行代码时,没有出现错误,SQL 会返回一个已经更新的对象,但它实际上并没有保存在数据库中
...
const res = await docInfo.save();
ctx.logger.info(JSON.stringify(res));
...
需要使用 markModified() 进行标记修改,否则数据将无法正确保存
docInfo.markModified('market_prices');
const res = await docInfo.save();
ctx.logger.info(JSON.stringify(res));