P
P
PrimaryWeb2018-10-11 17:53:44
MongoDB
PrimaryWeb, 2018-10-11 17:53:44

User.comparePassword is not a function, what should I do?

Displays

{
    "message": "User.comparePassword is not a function"
}

Here is the part of the code with comparePassword:
UserSchema.methods.comparePasswords = async function (password) {
  return await bcrypt.compare(password, this.password);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-10-11
@PrimaryWeb

"User.comparePassword is not a function"

Since the method should actually be called, what number should the passwords be in singular or plural? You already decide. Or do you not see the difference between comparePassword and comparePasswords?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question