Answers for "how to add new parameter in mongodb findbyidandupdate upsert which is not present in schema"

0

returned value by findOneAndUpdate

const filter = { age: 17 };
const doc = { $set: { name: "Naomi" } };
const options = { new: true };

Cat.findOneAndUpdate(filter, doc, options, (err, doc) => {
    if (err) console.log("Something wrong when updating data!");
    console.log(doc);
});
Posted by: Guest on November-12-2020

Code answers related to "how to add new parameter in mongodb findbyidandupdate upsert which is not present in schema"

Code answers related to "Javascript"

Browse Popular Code Answers by Language