ValidationError: User validation failed at MongooseError.ValidationError
<p>I am trying to create a simple node.js app with passport local authentication using mongoDb and express as a framework,but I'm having a problem </p>

<p>Whenever I try to submit the data into database using registration form,after clicking submit it appears in node terminal immediately :
<a href="https://i.stack.imgur.com/GQunw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GQunw.png" alt="node terminal"></a></p>

<p>here is how my user schema looks like:</p>

<pre><code>    var mongoose = require('mongoose');
var bcrypt   = require('bcrypt-nodejs');

// define the schema for our user model
var userSchema = mongoose.Schema({

    local            : {
        name    : String,
        username     : String,
        mobile       : Number,
        email        : String,
        gender       : String,
        password     : String

    }
});

// methods ======================
// generating a hash
userSchema.methods.generateHash = function(password) {
    return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};

// checking if password is valid
userSchema.methods.validPassword = function(password) {
    return bcrypt.compareSync(password, this.local.password);
};

// create the model for users and expose it to our app
module.exports = mongoose.model('User', userSchema);
</code></pre>

<p>and my router file :</p>

<pre><code> // process the signup form
    app.post('/signup', passport.authenticate('local-signup', {
        successRedirect : '/profile', // redirect to the secure profile section
        failureRedirect : '/signup', // redirect back to the signup page if there is an error
        failureFlash : true // allow flash messages
    }));
</code></pre>

<p>passport configuration for sign up logic :</p>

<pre><code>    passport.use('local-signup', new LocalStrategy({

    nameField     : 'name',    
    usernameField : 'username',
    mobileField   : 'mobile',
    emailField    : 'email',
    genderField   : 'gender',
    passwordField : 'password',
    passReqToCallback : true // allows us to pass back the entire request to the callback
},
function(req, name, username, mobile, email, gender, password, done) {

    // asynchronous
    // User.findOne wont fire unless data is sent back
    process.nextTick(function() {

    // find a user whose email is the same as the forms email
    // we are checking to see if the user trying to login already exists
    User.findOne({ 'local.email' :  email }, function(err, user) {
        // if there are any errors, return the error
        if (err)
            return done(err);


        // check to see if theres already a user with that email
        if (user) {
            return done(null, false, req.flash('signupMessage', 'That email is already taken.'));
        } else {

            // if there is no user with that email
            // create the user
            var newUser            = new User();

            // set the user's local credentials
            newUser.local.name     = name;
            newUser.local.username = username;
            newUser.local.mobile   = mobile;
            newUser.local.email    = email;
            newUser.local.gender   = gender;
            newUser.local.password = newUser.generateHash(password);

            // save the user
            newUser.save(function(err) {
                if (err)
                    throw err;

                return done(null, newUser);
            });
        }

    });

    });

}));
</code></pre>

<p>I am new to node.js as well as in mongoDb please help me out <br>
Thanks </p>