Mongoose 'reversed' population, i.e. populating a parent object based on the reference defined in child schema
<p>Let's borrow the excellent <a href="https://stackoverflow.com/a/14367812/4068479">example</a> from <a href="https://stackoverflow.com/users/445144/scaryguy">scaryguy</a> with modification as below:</p>

<p>Project Group Schema:</p>

<pre><code>var ProjectGroupSchema = new Schema({
    projectGroupId    : String,
    title             : String
});
</code></pre>

<p>Project Schema:</p>

<pre><code>var ProjectSchema = new Schema({
    title         : {type : String, default : '', required : true},
    group         : {type: String, ref: 'ProjectGroup' },
    subscribers   : [{type: String, ref: 'User' }]
});
</code></pre>

<p>User Schema:</p>

<pre><code>var UserSchema = new Schema({
    userId       : {type: String, require: true},
    firstName    : {type: String, required: true},
    lastName     : {type: String, required: true},
});
</code></pre>

<p>Then I can do following population:</p>

<pre><code>project.findById(req.projectId})
 .populate('subscribers')
 .populate('group')
 .exec(function(err, project){
      console.log(project);
 });
</code></pre>

<p>Note that the reference fields are not Object IDs.</p>

<p>In this example the project schema has the reference fields to both the project group and subscribers which makes the above population possible.</p>

<p>What if I want to get a ProjectGroup object, which contains all the projects under that group, and each project contains its subscribers?</p>

<p>I'd say I'm looking for a 'reversed' population, i.e. populating a parent object based on the reference defined in child schema.
At the moment I use async to query the ProjectGroup first, then query the projects based on the projectGroupId.</p>

<p>Thanks!</p>