Populate Aggregation Results of Child Schema in Mongoose
<p>I have the following (simplified) Schema</p>

<pre><code>var options = {discriminatorKey:'kind'};

var activitySchema = new Schema(
  {  
    title:{type:String}
  },options
);

var Activity = mongoose.model('Activity', activitySchema);

var dateActivitySchema = new Schema({
  postedBy:{type:Schema.Types.ObjectId,ref:'User',required:true}
},options);

var eventActivitySchema = new Schema({
  details:{
    eventType:{type:String, enum:['mixed','women','men']}
  }
},options);
</code></pre>

<p>I have a function that returns a mix of both child documents - date activities and event activities. However when I try to populate the postedBy field it does not populate the data as expected.</p>

<pre><code>Activity.aggregate([
    {
      $match:{
        $or:[{
          postedBy:{$in:results[0].userIDs}
        },
        {
          'details.eventType':eventGenderInterestedInMapper(user.gender,user.preferences.interestedInGenders),
          kind:'Event'
        }]
      }
    }
  ],function(err,results){
    Activity.populate(results,{path:'postedBy'},function(err,results){
      if (err) return cb(err,null);
      return cb(null,results);
    });
  });
</code></pre>

<p>Any way I can populate this child field from the base schema call or do I have to include the field in the base schema? I'm using the latest version of mongoose and from what I've found this functionality seems to be supported but it's not populating.</p>

<p>Edit: It populates only if the returned documents are ALL date activities. If there is one event activity then it populates none of the documents</p>