LiveQuery should match subobjects with dot notation (#3322)

* LiveQuery should match subobjects with dot notation

* one additional test case
This commit is contained in:
David Starke
2017-01-06 17:06:25 -08:00
committed by Arthur Cinader
parent edba550cf6
commit df029b82eb
2 changed files with 69 additions and 0 deletions

View File

@@ -133,6 +133,13 @@ function matchesKeyConstraints(object, key, constraints) {
if (constraints === null) {
return false;
}
if(key.indexOf(".") >= 0){
// Key references a subobject
var keyComponents = key.split(".");
var subObjectKey = keyComponents[0];
var keyRemainder = keyComponents.slice(1).join(".");
return matchesKeyConstraints(object[subObjectKey] || {}, keyRemainder, constraints);
}
var i;
if (key === '$or') {
for (i = 0; i < constraints.length; i++) {