Skip to content

Commit 02af61d

Browse files
committed
Merge pull request #1315 from drew-gross/bool-only
Accept only bool for $exists in LiveQuery
2 parents 57156cf + 01af755 commit 02af61d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/LiveQuery/QueryTools.js

+5
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ function matchesKeyConstraints(object, key, constraints) {
208208
case '$exists':
209209
let propertyExists = typeof object[key] !== 'undefined';
210210
let existenceIsRequired = constraints['$exists'];
211+
if (typeof constraints['$exists'] !== 'boolean') {
212+
// The SDK will never submit a non-boolean for $exists, but if someone
213+
// tries to submit a non-boolean for $exits outside the SDKs, just ignore it.
214+
break;
215+
}
211216
if ((!propertyExists && existenceIsRequired) || (propertyExists && !existenceIsRequired)) {
212217
return false;
213218
}

0 commit comments

Comments
 (0)