Merge pull request #1315 from drew-gross/bool-only
Accept only bool for $exists in LiveQuery
This commit is contained in:
@@ -208,6 +208,11 @@ function matchesKeyConstraints(object, key, constraints) {
|
|||||||
case '$exists':
|
case '$exists':
|
||||||
let propertyExists = typeof object[key] !== 'undefined';
|
let propertyExists = typeof object[key] !== 'undefined';
|
||||||
let existenceIsRequired = constraints['$exists'];
|
let existenceIsRequired = constraints['$exists'];
|
||||||
|
if (typeof constraints['$exists'] !== 'boolean') {
|
||||||
|
// The SDK will never submit a non-boolean for $exists, but if someone
|
||||||
|
// tries to submit a non-boolean for $exits outside the SDKs, just ignore it.
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ((!propertyExists && existenceIsRequired) || (propertyExists && !existenceIsRequired)) {
|
if ((!propertyExists && existenceIsRequired) || (propertyExists && !existenceIsRequired)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user