title: Node JS + Mongo DB: ValidationError: User validation failed: username: Path `username` is required because it force replaces the field
body: <p>I am trying to save my data to a mongodb server but somehow it force replaces the first variable as id so it is throwing the above mentioned error. in router code I am doing <strong>console.log(req.body,cred)</strong> and here is the result I get:</p>
  <blockquote>
  <p>{   emailAddress: 'test@gmail.com',   password: '123456',   id: '6070cbd7c603550ac4385485' }<br />
  {   _id: 6078c61277453c2170d7e177,  password: '123456',   id: '6070cbd7c603550ac4385485' }</p>
  </blockquote>
  <p>Can you please tell me why it force replaces emailAddresses value with _id ? What am I supposed to do?</p>
  <p><strong>User Schema Model</strong></p>
  <pre><code>const mongoose = require(&quot;mongoose&quot;);
  
  const CredSchema = mongoose.Schema({
      id: {
          type: String,
          required: true
      },
      username: {
          type: String,
          required: true
      },
      password: {
          type: String,
          required: true
      }
  }, {timestamps: true});
  
  // export model user with UserSchema
  module.exports = mongoose.model(&quot;cred&quot;, CredSchema);
  </code></pre>
  <p><strong>Router code</strong></p>
  <pre><code>router.post(
      &quot;/credentials&quot;,
      [
      ],
      async (req, res) =&gt; {
  
        const errors = validationResult(req);
        try {
          if (!errors.isEmpty()) {
            return res.status(400).json({
              errors: errors.array()
            });
          }
  
     
  
  
  
         cred = new Cred(req.body);
  
          console.log(req.body,cred);
  
  
       
  
          await cred.save(); 
  
  
  
          const payload = {
            user: {
              id: cred.id
            }
          };
  
  
          jwt.sign(
              payload,
              &quot;randomString&quot;,
              {
                expiresIn: 10000
              },
              (err, token) =&gt; {
                if (err) throw err;
                res.status(200).json({
                  token
                });
              }
          );
        }
          catch (err) {
          console.log(err.message);
          res.status(500).send(&quot;Error in Saving&quot;);
        }
      }
  );
  </code></pre>