当前位置: 代码迷 >> 综合 >> Mongoose - markModified
  详细解决方案

Mongoose - markModified

热度:13   发布时间:2024-01-15 11:47:02.0
mongoose中使用save方法修改嵌套数据时,添加order.markModified(‘checkResult’);这句,以完成修改操作,否则无法修改嵌套数据。
order = _.merge(order, req.body);
order.markModified('checkResult');
order.save().then(() => {return res.send({code: '400000', messageInfo: ['The update was successful.']});}).catch(err => next(err));