title: How can I return a value from a parent function in Node?
body: <pre><code>function validateLogin(username,passwordPlaintext) {
      db.collection('users').findOne({"username": username}, (function(err, user) {
          return bcrypt.compareSync(passwordPlaintext, user.passwordHash);
      });
  }
  </code></pre>
  
  <p>This is my current code. It receives a username and plaintext password and then hashes the password and compares it to the database. Using console.log, I've verified that everything works, but I can't figure out how to return the boolean that bcrypt produces from validateLogin().</p>