【发布时间】:2019-05-29 20:09:13
【问题描述】:
我开发了一个平均堆栈应用程序。我正在尝试使用 Date 字段的空值更新记录。这在我的本地主机上运行良好,但在我的服务器(Aws Ec2)上运行良好。它包含更新前的先前值。
我也尝试过“未定义”但仍然是同样的问题。
router.put('/editAssign/:id',(req,res)=>{
if(!ObjectId.isValid(req.params.id))
return res.status(400).send('No record with given id : $(req.params.id)');
var assignment = {
name: req.body.name,
code: req.body.code,
appointmentTime: req.body.appointmentTime,
scheduledTime:req.body.scheduledTime,
countEndTime: null
};
Assignment.findOneAndUpdate(req.params.id,{$set:assignment},{new:true},(err,doc)=>{
if(!err)
res.send(doc);
else
console.log('Error in Assignment Update: '+JSON.stringify(err,undefined,2));
});
});
我希望它也能在我的服务器上运行。
【问题讨论】:
标签: node.js angular mongodb mongoose