When I am executing other funcitons like find, add in database then they are running perfectly fine , but when I am updating the database entry then I am getting this error , I am using mongodb atlas, can someone help me how to solve this error. This is the github link of the code : Github URL
This is the error which I am getting
I searched on internet but didn’t find any solution which fixes my problem, so that’s why I am asking a new question, a similar kind of question already being asked but that didn’t work in my case
3
Answers
Your update query should look like this:
You may want to find by _id and update at the same time:
Use
Model.findOneAndUpdate()
.https://mongoosejs.com/docs/tutorials/findoneandupdate.html
From what I’m seeing in that library Customer.update() is not exposed as a standalone function but instead there’s the identifier updateCustomer one can call…
So use it directly like this…