title: Mongoose-encryption Failure, Page keeps rolling
body: <p>I am having a problem with an npm package called 'mongoose-encryption'. Here is my code.</p>
  <pre><code>main().catch((err) =&gt; console.log(err));
  
  async function main() {
      await mongoose.connect('mongodb://localhost:27017/userEncryptedDB', { useNewUrlParser: true });
  }
  
  const userSchema = new mongoose.Schema({
      email: String,
      password: String
  });
  
  const secret = 'xxs4Ox4nSKSVnJzIxzy+es6ouOmoMcqcarAnEVRP26Q=';
  
  userSchema.plugin(encrypt, {secret: secret, encryptedFields: ['password']});
  
  const User = mongoose.model('User', userSchema);
  </code></pre>
  <p>Now, if I don't use the package, registration and logging in to the website works properly but if I use the plug in, it says &quot;You are never registered!&quot; even though I register for the email and password...</p>
  <pre><code>app.post('/login', (req, res) =&gt; {
      const email = req.body.username;
      const password = req.body.password;
  
      User.findOne({email: email, password: password}, (err, user) =&gt; {
          if(err) {
              console.error(err);
          } else {
              if(user){
                  console.log('You are already registered!');
                  res.render('secrets');
              } else {
                  console.error('You are never registered!');
              }
          }
      });
  });
  </code></pre>
  <p>What am I doing wrong here? I started computer stopped database, restarted it. Registration is successfully done but when I try to login page keeps rolling... If I dont use mongoose-encryption, login page works fine once I enter password.</p>
  <p>I can clearly see that the new username gets added to the database like so:</p>
  <pre><code>{ &quot;_id&quot; : ObjectId(&quot;616a4aa45dfbf877d9f92468&quot;), &quot;email&quot; : &quot;aras@aras.com&quot;, &quot;_ct&quot; : BinData(0,&quot;YbVYW9Pi6dz1yqRD7XgcEyEp48lLGVjp3J40ZgxGt/YuA8+eyiyebMaO9AGdygBj6A==&quot;), &quot;_ac&quot; : BinData(0,&quot;YQiV2QvS9AyrE1hjm81x5U8K6+0lT8h1ruxtCEZv/iwZWyJfaWQiLCJfY3QiXQ==&quot;), &quot;__v&quot; : 0 }
  </code></pre>
  <p>But then when I try to login, it fails to retrieve password. Password I use here in this case is &quot;1&quot;.</p>