Skip to content

Commit

Permalink
Merge branch '4.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 22, 2017
2 parents 82c615c + ad69054 commit 48aeccc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -3598,7 +3598,15 @@ function getModelsMapForPopulate(model, docs, options) {
if (typeof ref === 'function') {
ref = ref.call(doc, doc);
}
modelNames = [ref];

// When referencing nested arrays, the ref should be an Array
// of modelNames.
if (Array.isArray(ref)) {
modelNames = ref;
} else {
modelNames = [ref];
}

isVirtual = true;
} else {
// We may have a discriminator, in which case we don't want to
Expand Down

0 comments on commit 48aeccc

Please sign in to comment.