title: TypeError: Cannot read properties of undefined reading 'email'
body: <pre><code>router.post('/login', async (res, req) =&gt; {
      const{error} = loginValidation(req.body);
      if (error) return res.status(400).send(error.details[0].message);
      
      //user validation
      const user = await User.findOne({ email: req.body.email });
      if (!user) return res.status(400).send(&quot;Email doesn't exists&quot;);
  
      //checking password
      const validPass = await bcrypt.compare(req.body.password, user.password);
      if (!validPass) return res.status(400).send('Invalid Password')
      
      res.send(&quot;logged in&quot;);
  });
  </code></pre>
  <p>The code is showing error ins this line body.email part :</p>
  <p>const user = await User.findOne({ email: req.body.email });</p>
  <p><a href="https://i.stack.imgur.com/SwGxA.png" rel="nofollow noreferrer">vscode error image </a></p>