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() no longer accepts a callback’);
2
Answers
it should be like
app.post('/contactForm',function(req,res){
})
https://mongoosejs.com/docs/migrating_to_7.html#dropped-callback-support