I have the following code:
connection((db) => {
db.collection('orders')
.updateOne(
{ "_id": req.body._id}, // Filter
{"name": req.body.name} // Update
)
.then((obj) => {
console.log('Updated - ' + obj);
res.redirect('orders')
})
.catch((err) => {
console.log('Error: ' + err);
})
})
I want to change the name in the order but it doesn't update it. The result in the console is
Updated - {"n":0,"nModified":0,"ok":1}
I tried to read the documentation but it's horrific