mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
(minimongo) Fix pull modifier not excepting null values
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user