app.post('/templates/views/login', async(req,res) => {
try {
const em = req.body.email;
const pass = req.body.pw;
const useremail = await db.Register.findOne({
email : em});
if(useremail.pass === pw){
res.status(201).render("index");
}else {
}
} catch (error) {
res.status(400).send("invalid email")
}
});
this is the code which i am having error with not able to get data from mongodb and verify data it is always giving output of invalid email