title: Node Express: Joi not converting to lowercase
body: <p>in my router I have </p>
  
  <pre><code>router.post('/user/register', User.validateRegister, User.register);
  </code></pre>
  
  <p>and the validate register function has the .lowercase() and trim() added but when the data hits the database its not lowercase?</p>
  
  <pre><code>  static validateRegister = async (req: Request, res: Response, next: NextFunction) =&gt; {
      const schema = Joi.object().keys({
        email: Joi.string().lowercase().trim().email({ minDomainSegments: 2 }),
        fullName: Joi.string().trim().max(30),
        password: Joi.string().trim().min(5),
      });
      const email = req.body.email;
      const password = req.body.password;
      const fullName = req.body.fullName;
      Joi.validate({ email, password, fullName }, schema, (err) =&gt; {
        if (!err) next(); else res.json(err.details);
      });
    };
  </code></pre>
  
  <p>the below is the register function </p>
  
  <pre><code>  static register = async (req: Request, res: Response) =&gt; {
      const email = req.body.email;
      const password = req.body.password;
      const fullName = req.body.fullName;
      const alreadyRegistered = await userModel.findOne({email}).exec();
      if (!alreadyRegistered) {
        const hashedPassword = await bcrypt.hash(password, 10);
        if (!hashedPassword) {
          res.status(500).send({ message: 'Failed to encrypt your password' });
        } else {
          const user = new userModel({email, password: hashedPassword, fullName} as UserModelInterface);
          const saved = await user.save();
          if (!saved) {
            res.status(500).send({ message: 'Failed to register you' });
          } else {
            res.status(200).send({ message: 'You are now registered' });
          }
        }
      } else {
        res.status(400).send({ message: 'You have already registered' });
      }
    };
  </code></pre>
  
  <p>My question is why isnt the email being converted to lowercase by Joi?</p>