show cloudinary uploaded image using mongoose show cloudinary uploaded image using mongoose mongoose mongoose

show cloudinary uploaded image using mongoose


This is the only mistake I see immediately:

User.findByIdAndUpdate(req.params.id, req.body.userimage...

is not how you update your user. Try this

User.findByIdAndUpdate(req.params.id, {userimage: req.body.userimage}...

Also I'm not sure if you can add a key to the request.body like that. You should probably just do:

User.findByIdAndUpdate(req.params.id, {userimage: result.secure_url}...