Why Password and Salt automatically in MEAN STACK?
<p>Here I am trying to verify mobile number in user module. I have created token and I sent to user but whenever user is trying to verify using that particular token 'Password' and 'salt' automatically got changed. How to avoid this? Some one help me out .. here I want to update only </p>

<pre><code>user.Mobileverification = 'verfied';
user.Mobileverificationcode = undefined;
user.mobileVerificationExpires = undefined;
</code></pre>

<p>Above three variables got changed but I don't know why password and salt has changed?</p>

<p>I have given my routes below:</p>

<pre><code>app.route('/auth/mobilereset/:token').get(users.mobileresetResetToken);
app.route('/auth/mobilereset/:token').post(users.mobilereset);
</code></pre>

<p>controller:</p>

<pre><code>exports.mobileresetResetToken = function(req, res) {
    User.findOne({
        Mobileverificationcode :req.params.token,
        mobileVerificationExpires: {
            $gt: Date.now()
         }
        // resetPasswordToken: req.params.token,
        // resetPasswordExpires: {
            // $gt: Date.now()
        // }
    }, function(err, user) {
        if (!user) {
            res.send({
                message: 'Invalid token'
            });


        } else {

            console.log('working fine');
        }
    });
};



exports.mobilereset = function(req, res, next) {


    async.waterfall([

        function(done) {
            User.findOne({
                Mobileverificationcode: req.params.token,
                mobileVerificationExpires: {
                    $gt: Date.now()
                }
            }, function(err, user) {
                if (!err &amp;&amp; user) {

                        user.Mobileverification = 'verfied';
                        user.Mobileverificationcode = undefined;
                        user.mobileVerificationExpires = undefined;

                        user.save(function(err) {
                            if (err) {
                                return res.status(400).send({
                                    message: errorHandler.getErrorMessage(err)
                                });
                            } else {
                                req.login(user, function(err) {
                                    if (err) {
                                        res.status(400).send(err);
                                    } else {
                                        // Return authenticated user 
                                        res.json(user);

                                        done(err, user);
                                    }
                                });
                            }
                        });

                } else {
                    return res.status(400).send({
                        message: 'reset token is invalid or has expired.'
                    });
                }
            });
        },

    ], function(err) {
        if (err) return next(err);
    });
};
</code></pre>

<p>model:</p>

<pre><code>var UserSchema = new Schema({

    username: {
        type: String,
        unique: 'testing error message',
        required: 'Please fill in a username',
        trim: true
    },
    password: {
        type: String,
        default: '',
        // validate: [validateLocalStrategyPassword, 'Password should be longer']
    },
    email: {
        type: String,
        trim: true,
        default: '',
        // validate: [validateLocalStrategyProperty, 'Please fill in your email'],
        // match: [/.+\@.+\..+/, 'Please fill a valid email address']
    },
    Mobilenumber: {
        type: String,
        default: ''
    },


    roles: {
        type: [{
            type: String,
            enum: ['user', 'admin']
        }],
        default: ['user']
    },
    salt: {
        type: String
    },
    provider: {
        type: String,
        required: 'Provider is required'
    },
    providerData: {},
    additionalProvidersData: {},

    updated: {
        type: Date
    },
    created: {
        type: Date,
        default: Date.now
    },
    /* For reset password */
    Mobileverificationcode: {
        type: String,
    },
    mobileVerificationExpires: {
        type: Date
    },
    Mobileverification: {
        type: String,
        trim: true,
        default: 'Not Verified',
    },
    resetPasswordToken: {
        type: String
    },
    resetPasswordExpires: {
        type: Date
    }
});
</code></pre>