I am trying to update record of mongodb using updateOne method but it's not working.
async function updateCourse(id) {
const result = await Course.updateOne({_id : id }, { name: 'Abc'},
function(err, res) {});
console.log(result);
}
anyone please suggest possible solution to fix this issue.
Thanks
try this code
const test = async function updateCourse(id) {
const result = await Course.updateOne({ _id: id }, { name: "Abc" })
console.log(result);
};
If you using async await, don't use callback again
I hope this can help you. Thank you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With