title: Data and salt arguments required
body: <p>I'm trying to hash the password of admin in my site. I have searched and found out that this error is because of being <code>null</code> or <code>undefined</code> the value that we want to hash it.</p>
  
  <p>here is my code, whenever I console.log(admin) it returns <code>{}</code>, I don't know why.</p>
  
  <pre><code>adminSchema.pre('save', (next) =&gt; {
      var admin = this;
      console.log(admin)
      bcrypt.hash(admin.password, 10, (err, hash) =&gt; {
          if (err) return next(err);
          admin.password = hash;
          next();
      });
  });
  
  var adminModel = mongoose.model('Admin', adminSchema);
  module.exports = adminModel;
  </code></pre>
  
  <p>server side code: </p>
  
  <pre><code>var adminModel = require('./../models/admins');
  router.post('/register', (req, res) =&gt; {
      var newAdmin = {
          adminName: req.body.adminName,
          faculty: req.body.faculty,
          email: req.body.email,
          password: req.body.password
      }
  
      adminModel.create(newAdmin, (err, admin) =&gt; {
          if (err) {
              console.log('[Admin Registration]: ' + err);
          }
          else {
              console.log('[Admin Registration]: Done');
              req.session.adminId = admin._id;
              res.redirect('/admin/submitScore')
          }
      })
  });
  </code></pre>
  
  <p>Unfortunately, I can't find the reason of that the console.log(admin) is empty. I would be thankful if anyone could help me.</p>