findbyid and update mongoose
xxxxxxxxxx
// Find a document whose
// user_id=5eb985d440bd2155e4d788e2 and update it
// Updating name field of this user_id to name='Ali'
var user_id = '5eb985d440bd2155e4d788e2';
User.findByIdAndUpdate(user_id, { name: 'Ali' },
function (err, docs) {
if (err){
console.log(err)
}
else{
console.log("Updated User : ", docs);
}});