Skip to content

Commit

Permalink
fix(populate): use base model name if no discriminator for backwards …
Browse files Browse the repository at this point in the history
…compat

Fix #4843
  • Loading branch information
vkarpov15 committed Jan 1, 2017
1 parent f0aa82d commit 62c8b08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/model.js
Expand Up @@ -2985,7 +2985,9 @@ function getModelsMapForPopulate(model, docs, options) {
modelNames = [virtual && virtual.options && virtual.options.ref];
isVirtual = true;
} else {
modelNames = null;
// We may have a discriminator, in which case we don't want to
// populate using the base model by default
modelNames = discriminatorKey ? null : [model.modelName];
}
} else {
modelNames = [modelNameFromQuery]; // query options
Expand Down

0 comments on commit 62c8b08

Please sign in to comment.