title: How to fix "User validation failed: password: Path `password` is required., email: Path `email` is required., name: Path `name` is required."
body: <p>I'm a beginner who starts to learn node.js. In the middle of the way, I got a problem with a notification like this</p>
  <pre><code>{
  &quot;errors&quot;: {
      &quot;password&quot;: {
          &quot;name&quot;: &quot;ValidatorError&quot;,
          &quot;message&quot;: &quot;Path `password` is required.&quot;,
          &quot;properties&quot;: {
              &quot;message&quot;: &quot;Path `password` is required.&quot;,
              &quot;type&quot;: &quot;required&quot;,
              &quot;path&quot;: &quot;password&quot;
          },
          &quot;kind&quot;: &quot;required&quot;,
          &quot;path&quot;: &quot;password&quot;
      },
      &quot;email&quot;: {
          &quot;name&quot;: &quot;ValidatorError&quot;,
          &quot;message&quot;: &quot;Path `email` is required.&quot;,
          &quot;properties&quot;: {
              &quot;message&quot;: &quot;Path `email` is required.&quot;,
              &quot;type&quot;: &quot;required&quot;,
              &quot;path&quot;: &quot;email&quot;
          },
          &quot;kind&quot;: &quot;required&quot;,
          &quot;path&quot;: &quot;email&quot;
      },
      &quot;name&quot;: {
          &quot;name&quot;: &quot;ValidatorError&quot;,
          &quot;message&quot;: &quot;Path `name` is required.&quot;,
          &quot;properties&quot;: {
              &quot;message&quot;: &quot;Path `name` is required.&quot;,
              &quot;type&quot;: &quot;required&quot;,
              &quot;path&quot;: &quot;name&quot;
          },
          &quot;kind&quot;: &quot;required&quot;,
          &quot;path&quot;: &quot;name&quot;
      }
  },
  &quot;_message&quot;: &quot;User validation failed&quot;,
  &quot;message&quot;: &quot;User validation failed: password: Path `password` is required., email: Path `email` is required., name: Path `name` is required.&quot;}
  </code></pre>
  <p>This My User Model</p>
  <pre><code>const mongoose = require('mongoose')
  const validator = require('validator')
  
  const User = mongoose.model('User', {
      name: {
          type: String,
          required: true,
          trim: true
      }, 
      email: {
          type: String, 
          required: true,
          trim: true,
          lowercase: true,
          validate(value) {
              if (!validator.isEmail(value)) {
                  throw new Error('Email is invalid')
              }
          }
      },
      password:{
          type: String,
          required: true, 
          minlength: 7,
          trim: true,
           validate(value){
              if (value.toLowerCase().includes('password')) {
                  throw new Error('Password cannot contain &quot;password&quot;')
              }
          }
      },
      age: {
          type: Number, 
          default: 0,
          validate(value) {
              if (value &lt; 0 ){
                  throw new Error('Age must be a positive number')
              }
          }
      }
  })
  
  module.exports = User
  </code></pre>
  <p>With this user route</p>
  <pre><code>const express = require('express')
  require('./db/mongoose')
  const User = require('./models/user')
  const Task = require('./models/task')
  
  const app = express()
  const port = process.env.PORT || 3000
  
  app.use(express.json())
  
  app.post('/users', async (req, res) =&gt; {
      const user = new User(req.body)
  
      try{
          await user.save()
          res.status(201).send(user)
      } catch (e) {
          res.status(400).send(e)
      }
  })
  
  
  
  app.listen(port, () =&gt; {
      console.log('Server is up on port' +port)
  })
  </code></pre>
  <p>Does anyone understand why it would be happening?</p>
  <p>Hope I get the answer in this forum to continue my study. Thank you in advance for your help guys. Really appreciate it.</p>