I have a problem with MongoDB not updating edited data. I know that the id passed is working because is the same in both my browser console and my server console. I have tried everything and nothing seams to be working.
app.put('/contactlist/:id', function (req, res) {
var id = req.params.id;
console.log(id);
db.contactlist.findAndModify({
query: {_id: mongojs.ObjectId(id)},
update: {$set: {"name": req.body.name, "email": req.body.email, "number": req.body.number}},
upsert: true}, function (err, doc) {
res.json(doc);
}
);
});
via EDGECRUSHER
No comments:
Post a Comment