userSchema.pre('save', async function(next){ if (!this.isModified('password')) return next() this.password = await bcrypt.hash(this.password, 8) next() })
userSchema.pre('save', async function(next){ if (!this.isModified('password')) return next() this.password = await bcrypt.hash(this.password, 8) next() })