From aa7b529be017ec5c7f158d6bf0ed1b8e736d1343 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 16 Feb 2021 12:24:29 -0500 Subject: [PATCH] fix(populate): set not found values to `null` for paths that are not in the schema Fix #9913 --- lib/helpers/populate/assignVals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers/populate/assignVals.js b/lib/helpers/populate/assignVals.js index 9fd51d80967..a09b1007473 100644 --- a/lib/helpers/populate/assignVals.js +++ b/lib/helpers/populate/assignVals.js @@ -240,7 +240,7 @@ function valueFilter(val, assignmentOpts, populateOptions) { if (populateOptions.justOne === false) { return []; } - return val; + return val == null ? val : null; } /*!