LearnBoost/mongoose — Issue #636: populate inside embedded document
Author: Raigen
Created: 2011-12-05 16:18:56+00:00
State: open

I am triying to populate a key inside of an embedded document. I thought it was possible but it is not working.
Schemas are like

```javascript
var Value = new Schema({
status: {type: String},
value: {type: Schema.Types.Mixed}
});
var Feature = new Schema({
featureRef: {type: String, required: true},
type: {type: String},
values: {type: [Value] }
});
mongoose.model('Feature', Feature);
var Category = new Schema({
name: {type: String, required: true},
features: [{ type: Schema.ObjectId, ref: 'Feature'}]
});
var List = new Schema({
name: { type: String, required: true},
listType: { type: String },
categories: { type: [Category] }
});
```

and the call is like

```javascript
var List = mongoose.model('List');
List
.findById(validObjectId)
.populate('categories.features')
.run(function (error, list) {
console.log(list); // features in categories are arrays with ObjectId's
});
```