From c11b363ae5f2b2f608f174b503e8b81c45d6a6a7 Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Tue, 2 Sep 2014 09:16:58 +0200 Subject: [PATCH] Fixed --- lib/model.js | 2 +- test/model.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/model.js b/lib/model.js index 18a8023..a832121 100644 --- a/lib/model.js +++ b/lib/model.js @@ -534,7 +534,7 @@ comparisonFunctions.$gte = function (a, b) { }; comparisonFunctions.$ne = function (a, b) { - if (!a) { return true; } + if (a === undefined) { return true; } return !areThingsEqual(a, b); }; diff --git a/test/model.test.js b/test/model.test.js index d1057b8..79796e8 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -1040,6 +1040,7 @@ describe('Model', function () { model.match({ a: 5 }, { a: { $ne: 4 } }).should.equal(true); model.match({ a: 5 }, { a: { $ne: 5 } }).should.equal(false); model.match({ a: 5 }, { b: { $ne: 5 } }).should.equal(true); + model.match({ a: false }, { a: { $ne: false } }).should.equal(false); }); it('$in', function () {