logo

Crowdly

Browser

Add to Chrome

MongoDB У схемі користувача є pre-save хук для хешування пароля: userSchema.pre(...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

MongoDB

У схемі користувача є pre-save хук для хешування пароля:

userSchema.pre('save', async function() {

if (this.isModified('password')) {

this.password = await bcrypt.hash(this.password, 10);

}

});

Чому перевірка isModified('password') критично важлива?

0%
0%
0%
100%
More questions like this

Want instant access to all verified answers on learn.ztu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome