From b5d9df66c1a265b64d49f3c16367a7dbd76b7bee Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Wed, 9 Oct 2013 15:24:00 -0700 Subject: [PATCH] Tests for "observe array element" case ex.: collection.find({ 'foo.0.bar': 2 }) // => find docs with bar of first element of array foo being 2 --- packages/minimongo/minimongo_tests.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index e553a0af4a..8996efc487 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -2441,12 +2441,11 @@ Tinytest.add("minimongo - modifier affects selector", function (test) { notAffected({ 'foo.Infinity.x': 0 }, { $unset: { 'foo.x': 1 } }, "we convert integer fields correctly"); notAffected({ 'foo.1e3.x': 0 }, { $unset: { 'foo.x': 1 } }, "we convert integer fields correctly"); - // XXX once we consider all the array/non-array operators separately, this - // should become notAffected. Until then it's fine to let it "match" and - // affect. - //notAffected({ 'foo.3.bar': 0 }, { $set: { 'foo.2.bar': 1 } }, "observe for an array element"); - affected({ 'foo.3.bar': 0 }, { $set: { 'foo.2.bar': 1 } }, "observe for an array element"); - affected({ 'foo.3.bar': 0 }, { $set: { 'foo.3.bar': 1 } }, "observe for an array element"); + + notAffected({ 'foo.4.bar.baz': 0 }, { $unset: { 'foo.3.bar': 1 } }, "delicate work with numeric fields in selector"); + notAffected({ 'foo.4.bar.baz': 0 }, { $unset: { 'foo.bar': 1 } }, "delicate work with numeric fields in selector"); + affected({ 'foo.4.bar.baz': 0 }, { $unset: { 'foo.4.bar': 1 } }, "delicate work with numeric fields in selector"); + affected({ 'foo.bar.baz': 0 }, { $unset: { 'foo.3.bar': 1 } }, "delicate work with numeric fields in selector"); });