title: Mongoose - multiple parameters in findOne
body: <p>Here is a route I have:</p>
  
  <pre><code>router.get('/home', function (req, res) {
  User.findOne({_id: req.user._id}, function (err, user) {
      if (err) return next(err);
      res.render('home', {user: user});
  });
  });
  </code></pre>
  
  <p>Basically, in order for someone to view this /home page they need to be logged in, which is where User.findOne comes into play. It will search for the user in the 'user' collection; if it doesn't find the user (if the user isn't logged in), it will return an error. Otherwise, it will show them the /home page.</p>
  
  <p>Now, I want to have a separate Admin section of my website where only users with admin privileges can access the page. I've tried doing something like this:</p>
  
  <pre><code>router.get('/admin', function (req, res) {
  User.findOne({_id: req.user._id, admin: true}, function (err, user) {
      if (err) return next(err);
      res.render('admin', {user: user});
  });
  });
  </code></pre>
  
  <p>What I'm trying to get the code to do is to look for 2 parameters: whether the user is logged in, and whether or not in that user document their 'admin' is set to 'true'. Obviously the above code doesn't work, and I don't know how to get this to work better.</p>
  
  <p>EDIT: my user schema:</p>
  
  <pre><code>var schema = mongoose.Schema;
  var UserSchema = new schema ({
  username: {type: String, unique: true},
  email: {type: String, unique: true, lowercase: true, required: true},
  password: {type: String, minlength: passMinLength, required: true},
  admin: {type: Boolean, default: false},
  profile: {
      firstName: {type: String, default: ''},
      lastName: {type: String, default: ''}
  }
  });
  </code></pre>