//generate password reset hash userSchema.methods.generatePasswordResetHash = function(){ //create hash object, //then create a sha512 hash of the user's hashed password //and then return hash const resetHash = crypto.createHash('sha512').update(this.hash).digest('hex') return resetHash; }