I am trying to update MongoDB database with mongoose
Works but I can't get a call back with new data
Templates.updateOne((req.query, req.body))
does not work
Templates.updateOne(req.query, req.body, { new: true }, (err, data) => {
console.log("just call back", data);
})
the data that is coming from req.query
{title: "Hello World"}
the data that is coming from req.body
{_ref: "your ref}
I am hoping to be able to update with callback and new data to console.log
According to the doc, Document.prototype.updateOne() does not accept {new:true} (it is a native MongoDB command, I believe), but Model.findOneAndUpdate() does.