title: Mongoose validation fails for required fields even when I provide values for that fields
body: <p>I have the following model:</p>
  
  <pre><code>/**
   * @module optikos
   */
  const mongoose = require('mongoose');
  
  /**
   * Define the schema of the main table(Document)
   * Needs to be redefined to add user role here
   */
  const dbUri = 'mongodb://localhost:27017/optikosmaindb';
  mongoose.connect(dbUri,{ useNewUrlParser: true });
  const optikosSchema = mongoose.Schema({
      name: {
          type: String
      },
      email: {
          type: String,
          required:[true,'Email is required']
      },
      password: {
          type: String,
          required:[true,'Password is required']
      },
      dbpath: {
          type: String,
          required:true
      },
      role:{
          type:String,
          lowercase:true,
          enum:{
              values:['admin','employee','shop owner'],
              message:'`${VALUE} is not a valid role`'
          },
          default:'shop owner'
      },
      payment_status: {
          /***
           * Only show owners need to have a payment status
           */
          required:this.role == 'shop owner',
          type: String,
          lowercase:true,
          enum:{
              values:['pending','paid'],
              message:'`{VALUE} is not a valid payment status`'
          },
          default: 'pending' //will change to paid once a payment transaction is completed
  
      },
      payment_reset: {
          required:this.role == 'shop owner',
          type: Date,
          default:Date.now
      }
  });
  
  const Optikos = mongoose.model('optikos',optikosSchema);
  module.exports = Optikos;
  </code></pre>
  
  <p>I have another file called <code>index.js</code> in which I require it like this to create some users for my database:</p>
  
  <pre><code>const admins = require('./admins');
  const Optikos = require('../schemas/optikos');
  const bcrypt = require('bcrypt');
  async function setup() {
      console.log('Setting app Optikos main database');
  
      try {
  
          let registeredAdmins = admins.map(async admin=&gt;{
              let {email,name,password} = admin;
              let role = 'admin';
              let saltRounds = 10;
              password = await bcrypt.hash(password,saltRounds);
  
              let dbpath = dbUri;
              let user = new Optikos({
                  'name':name,
                  'email':email,
                  'password':password,
                  'role':role,
                  'dbpath':dbpath
              });
  
              return user;
          });
          let response  = await Optikos.create(registeredAdmins);
          console.log('Registered admins')
          process.exit(0);
      } catch (e) {
          console.log('Error error error')
          console.log(e)
          process.exit(1)
      }
  
  }
  
  setup();
  </code></pre>
  
  <p>The admins file is an array of objects containing a name,email and password fields.However after trying to run the <code>index</code>file I get the following: "{ ValidationError: optikos validation failed: dbpath: Path <code>dbpath</code> is required., password: Password is required, email: Email is required".However If I log all the variables that I am passing to "new Optikos()" I get the values that I expect.What is wrong?</p>