mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Another test to ensure correct observation of object literals.
This commit is contained in:
@@ -2413,6 +2413,24 @@ Tinytest.add("minimongo - modifier affects selector", function (test) {
|
||||
{$and: [{ 'x.d': { $ne: 5, $gte: 433 } }, { 'a.b': 234 }]}]
|
||||
}, ['a.b', 'a.b.c', 'x.d'], 'group operators + duplicates');
|
||||
|
||||
// When top-level value is an object, it is treated as a literal,
|
||||
// so when you query col.find({ a: { foo: 1, bar: 2 } })
|
||||
// it doesn't mean you are looking for anything that has 'a.foo' to be 1 and
|
||||
// 'a.bar' to be 2, instead you are looking for 'a' to be exatly that object
|
||||
// with exatly that order of keys. { a: { foo: 1, bar: 2, baz: 3 } } wouldn't
|
||||
// match it. That's why in this selector 'a' would be important key, not a.foo
|
||||
// and a.bar.
|
||||
testSelectorPaths({
|
||||
a: {
|
||||
foo: 1,
|
||||
bar: 2
|
||||
},
|
||||
'b.c': {
|
||||
literal: "object",
|
||||
but: "we still observe any changes in 'b.c'"
|
||||
}
|
||||
}, ['a', 'b.c'], "literal object");
|
||||
|
||||
function testSelectorAffectedByModifier (sel, mod, yes, desc) {
|
||||
if (yes)
|
||||
test.isTrue(LocalCollection._isSelectorAffectedByModifier(sel, mod, desc));
|
||||
|
||||
Reference in New Issue
Block a user