[Vuejs]-MongooseError [CastError]: Cast to ObjectId failed for value "undefined" at path "_id" for model "User"

0👍

I suspect the error originates from the try section. Look at the code below

              const editUser = await User.findByIdAndUpdate(_id,user,{

Arent you supposed to use only the _id, in which case the user is redundant. What happens when you remove it (,user,)

Leave a comment