From 9c26c41ef60a0a5ec44ea79a8d67b7f2d70585ba Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Sun, 1 Dec 2013 17:41:07 +0100 Subject: [PATCH] Dot notation is now able to go inside arrays and array indexes --- test/model.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/model.test.js b/test/model.test.js index 4c5f87d..3c05dd1 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -908,6 +908,12 @@ describe('Model', function () { model.match({ a: { b: 5 } }, { a: { b: { $lt: 10 } } }).should.equal(false); (function () { model.match({ a: { b: 5 } }, { a: { $or: [ { b: 10 }, { b: 5 } ] } }) }).should.throw(); }); + + it("Can match for field equality inside an array with the dot notation", function () { + mode.match({ a: true, b: [ 'node', 'embedded', 'database' ] }, { 'b.1': 'node' }).should.equal(false); + mode.match({ a: true, b: [ 'node', 'embedded', 'database' ] }, { 'b.1': 'embedded' }).should.equal(true); + mode.match({ a: true, b: [ 'node', 'embedded', 'database' ] }, { 'b.1': 'database' }).should.equal(false); + }) });