我正在尝试使用updateOne函数更新MongoDB中的文档。我没有收到任何错误,程序正在使用正确的ID,但是文档没有更新。如果有人可以告诉我我要去哪里错了,将不胜感激。
事件模式代码为:
需求主体是:
答案 0 :(得分:1)
信息对象中的字段必须与事件模式中的字段名称匹配:
所以您需要这样更改:
const information = {
eventName: req.body.eventName,
eventLength: req.body.eventLength,
startDate: req.body.startDate,
endDate: req.body.endDate,
venueName: req.body.venueName,
venueCity: req.body.venueCity,
venueState: req.body.venueState,
photographerCB: req.body.photographerCB,
photographyBudget: req.body.photographyBudget,
videographerCB: req.body.videographerCB,
videographyBudget: req.body.videographyBudget,
entertainmentCB: req.body.entertainmentCB,
entertainmentBudget: req.body.entertainmentBudget,
};