// user is your result from userschema using mongoose id user.setPassword(req.body.password, function (err) { user.save() if (err) { console.log(err); } else { res.redirect('/') } })