Missing await keyword in user.model.js

Author: harshvats2000Created Nov 29, 2021Updated Dec 28, 2025

At line 73 in user.model.js, below function is written:

javascript
userSchema.methods.isPasswordMatch = async function (password) {
  const user = this;
  return bcrypt.compare(password, user.password);
};

I believe there is a missing await keyword in return statement as the compare function is an async function. If bcrypt.compare doesn't return promise, then async is redundant.

So the final code should be

javascript
userSchema.methods.isPasswordMatch = async function (password) {
  const user = this;
  return await bcrypt.compare(password, user.password);
};

Source: hagopj13/node-express-boilerplate