diff --git a/lib/model.js b/lib/model.js index bbbdc124806..fe40fe373ce 100644 --- a/lib/model.js +++ b/lib/model.js @@ -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