Skip to content

Commit

Permalink
fix(populate): filter out nonexistant values for dynref
Browse files Browse the repository at this point in the history
Fix #4637
  • Loading branch information
vkarpov15 committed Oct 22, 2016
1 parent 2baf277 commit 8d26dea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2927,6 +2927,11 @@ function getModelsMapForPopulate(model, docs, options) {

if (refPath) {
modelNames = utils.getValue(refPath, doc);
if (Array.isArray(modelNames)) {
modelNames = modelNames.filter(function(v) {
return v != null;
});
}
} else {
if (!modelNameFromQuery) {
var modelForCurrentDoc = model;
Expand Down

0 comments on commit 8d26dea

Please sign in to comment.