title: Mongoose querying data that needs populating
body: <p>I have a Mongoose model that is pretty simple:</p>
  
  <pre><code>aclSchema = mongoose.Schema({
      _id: String,
      public_read: Boolean,
      public_write: Boolean,
  });
  aclModel = mongoose.model('acl', aclSchema);
  </code></pre>
  
  <p>And another model that references it:</p>
  
  <pre><code>thingSchema = mongoose.Schema({
      _id: String,
      _acl: { type: String, ref: 'acl' }
  });
  thingModel = mongoose.model('thing', thingSchema);
  </code></pre>
  
  <p>I need to be able to find documents ( thingModel ) where _acl.public_read is true. The problem i'm having is that since thing._acl is a ref, it's not populated until after the querying is done.</p>
  
  <p>example:</p>
  
  <pre><code>thingModel.find({"_acl.public_read":true}).populate('_acl').exec(callback);
  </code></pre>
  
  <p>That returns no results because, I guess, _acl is a ref and it's not populated until after the find returns documents.</p>
  
  <p>Just a side note, the schema's are more complicated than this and have other ref's in them that could be circular. I have not included them for simplicity sake, but the basic idea is there. If it was really this simple, i would use sub-documents and it would all work as expected.</p>
  
  <p>Is there a better way to do this so I get the expected documents? </p>