From a454e3d4acc714a2c7211aad7075f58c048cbdaa Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Wed, 22 May 2013 20:55:43 +0200 Subject: [PATCH] Test array behaviour at model level --- test/model.test.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/model.test.js b/test/model.test.js index 81dbadb..c8140ea 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -325,7 +325,7 @@ describe('Model', function () { }); // ==== End of 'Modifying documents' ==== // - describe('Finding documents', function () { + describe('Querying', function () { describe('Comparing things', function () { @@ -412,6 +412,12 @@ describe('Model', function () { model.match({ test: { pp: undefined } }, { "test.pp": undefined }).should.equal(false); }); + it('For field array, a match means a match on at least one element', function () { + model.match({ tags: ['node', 'js', 'db'] }, { tags: 'python' }).should.equal(false); + model.match({ tags: ['node', 'js', 'db'] }, { tags: 'js' }).should.equal(true); + model.match({ tags: ['node', 'js', 'db'] }, { tags: 'js', tags: 'node' }).should.equal(true); + }); + }); }); // ==== End of 'Finding documents' ==== //