mesan-nodejs-auth-crud-api
mesan-nodejs-auth-crud-api copied to clipboard
fix: findByIdAndUpdate; callback funtion return object,object
hotfix: On update of profile image, an error is returned from the mongoose function findByIdAndUpdate.
A detailed explanation can be found here: https://stackoverflow.com/questions/66370059/findoneandupdate-callback-must-be-a-function-got-object-object-nodejs-mon
Also a loop after updating profile image as !req.file checks if there is no file. But using result.url with return the accurate response by checking if image URL was updates on the db.