Skip to content

Commit

Permalink
fix; dont flatten empty arrays in updateValidators (Fix #3554)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 9, 2015
1 parent f0b0f61 commit 68e394d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/services/updateValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ function modifiedPaths(update, path, result) {
var val = update[key];

result[path + key] = true;

if (shouldFlatten(val)) {
modifiedPaths(val, path + key, result);
}
Expand Down Expand Up @@ -194,5 +193,6 @@ function shouldFlatten(val) {
return val &&
typeof val === 'object' &&
!(val instanceof Date) &&
!(val instanceof ObjectId);
!(val instanceof ObjectId) &&
(!Array.isArray(val) || val.length > 0);
}

0 comments on commit 68e394d

Please sign in to comment.