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
This commit is contained in:
Slava Kim
2013-10-09 15:24:00 -07:00
committed by David Glasser
parent a75470bcf3
commit b5d9df66c1

View File

@@ -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");
});