Skip to content

Commit

Permalink
fix(populate): use correct model with discriminators + nested populate
Browse files Browse the repository at this point in the history
Fix #5858
  • Loading branch information
vkarpov15 committed Dec 19, 2017
1 parent ed8e874 commit 4e64596
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -3261,7 +3261,9 @@ function populate(model, docs, options, callback) {
mod.options.options.limit = mod.options.options.limit * ids.length;
}

var subPopulate = mod.options.populate;
var subPopulate = utils.clone(mod.options.populate, {
retainKeyOrder: true
});
var query = mod.Model.find(match, select, mod.options.options);

// If we're doing virtual populate and projection is inclusive and foreign
Expand Down

0 comments on commit 4e64596

Please sign in to comment.