How can I populate nested referenced models?
For example:
// \'Collection\' model
var CollectionSchema = new Schema({
collection_name: String,
_g
-
I would rather do
var Group = mongoose.model('Group', GroupSchema);
Group.find().populate('_item _meta').exec(function (error, groups) {
// ...
});
讨论(0)
-
var Group = mongoose.model('Group', GroupSchema);
Group.find().populate('_item').populate('_meta').exec(function (error, groups) {
//groups will be an array of group instances and
// _item and _meta will be populated
});
讨论(0)
- 热议问题