app.post('/ contactForm',function(req,res){
Contact.create({
name: req.body.name,
phone: req.body.phone
}, function(err, newContact){
if(err){
console.log(err, 'error in connectiong');
return;
}
console.log("*******", newContact);
return res.redirect('back');
})
})
/home/ganesh/Web Dev/CN Web Dev/HTML/basics/Nodejs Workspace/contact_list/node_modules/mongoose/lib/model.js:2771 throw new MongooseError('Model.create()不再接受回调');
2条答案
按热度按时间b1uwtaje1#
应该是
app.post('/ contactForm',function(req,res){
})
7d7tgy0s2#
https://mongoosejs.com/docs/migrating_to_7.html#dropped-callback-support