title: Find after populate mongoose
body: <p>I'm having some trouble querying a document by values matching inside the document after population by mongoose.</p>
  
  <p>My schemas are something like this:</p>
  
  <pre><code>var EmailSchema = new mongoose.Schema({
    type: String
  });
  
  var UserSchema = new mongoose.Schema({
    name: String,
    email: [{type:Schema.Types.ObjectId, ref:'Email'}]
  });
  </code></pre>
  
  <p>I would like to have all users which have a email with the type = "Gmail" for example. </p>
  
  <p>The following query returns empty results:</p>
  
  <pre><code>Users.find({'email.type':'Gmail').populate('email').exec( function(err, users)
      {
        res.json(users);
      });
  </code></pre>
  
  <p>I have had to resort to filtering the results in JS like this: </p>
  
  <pre><code>users = users.filter(function(user)
          {
            for (var index = 0; index &lt; user.email.length; index++) {
              var email = user.email[index];
              if(email.type === "Gmail")
              {
                return true;
              }
            }
            return false;
          });
  </code></pre>
  
  <p>Is there any way to query something like this straight from mongoose? </p>