diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index 23c4d49af6..ecc9f003fb 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -2326,6 +2326,7 @@ Tinytest.add("minimongo - modify", function (test) { modify({a: [2, 1, 2]}, {$pull: {a: 1}}, {a: [2, 2]}); modify({a: [2, 1, 2]}, {$pull: {a: 2}}, {a: [1]}); modify({a: [2, 1, 2]}, {$pull: {a: 3}}, {a: [2, 1, 2]}); + modify({a: [1, null, 2, null]}, {$pull: {a: null}}, {a: [1, 2]}); modify({a: []}, {$pull: {a: 3}}, {a: []}); modify({a: [[2], [2, 1], [3]]}, {$pull: {a: [2, 1]}}, {a: [[2], [3]]}); // tested diff --git a/packages/minimongo/modify.js b/packages/minimongo/modify.js index 00ff5a21bb..3b49ff0443 100644 --- a/packages/minimongo/modify.js +++ b/packages/minimongo/modify.js @@ -361,7 +361,7 @@ var MODIFIERS = { throw MinimongoError("Cannot apply $pull/pullAll modifier to non-array"); else { var out = []; - if (typeof arg === "object" && !(arg instanceof Array)) { + if (arg != null && typeof arg === "object" && !(arg instanceof Array)) { // XXX would be much nicer to compile this once, rather than // for each document we modify.. but usually we're not // modifying that many documents, so we'll let it slide for