Skip to content

Commit 48aeccc

Browse files
committed
Merge branch '4.13'
2 parents 82c615c + ad69054 commit 48aeccc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/model.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3598,7 +3598,15 @@ function getModelsMapForPopulate(model, docs, options) {
35983598
if (typeof ref === 'function') {
35993599
ref = ref.call(doc, doc);
36003600
}
3601-
modelNames = [ref];
3601+
3602+
// When referencing nested arrays, the ref should be an Array
3603+
// of modelNames.
3604+
if (Array.isArray(ref)) {
3605+
modelNames = ref;
3606+
} else {
3607+
modelNames = [ref];
3608+
}
3609+
36023610
isVirtual = true;
36033611
} else {
36043612
// We may have a discriminator, in which case we don't want to

0 commit comments

Comments
 (0)