I am trying to check my password in while logging in in I also have hashed my password. so I am comparing it using brcrypt. But it is giving me error enter image description here my user schema is this enter image description here and my login functoin is this enter image description here
let user = await User.findOne({ email: req.body.email }).lean().exec();
should be
let user = await User.findOne({ email: req.body.email });
Because lean
has result is plain old JavaScript objects (POJOs), not Mongoose documents.
Ref to here