Skip to content

Commit

Permalink
Merge 94d387f into 3a2afda
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Posthuma authored Jun 21, 2021
2 parents 3a2afda + 94d387f commit 213e98e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ ___
- Add NPM package-lock version check to CI (Manuel Trezza) [#7333](https://github.com/parse-community/parse-server/pull/7333)
- Fix incorrect LiveQuery events triggered for multiple subscriptions on the same class with different events [#7341](https://github.com/parse-community/parse-server/pull/7341)
- Fix select and excludeKey queries to properly accept JSON string arrays. Also allow nested fields in exclude (Corey Baker) [#7242](https://github.com/parse-community/parse-server/pull/7242)
- Fix LiveQuery server crash when using $all query operator on a missing object key (Jason Posthuma) [#7421](https://github.com/parse-community/parse-server/pull/7421)

___
## 4.5.0
Expand Down
10 changes: 10 additions & 0 deletions spec/QueryTools.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ describe('matchesQuery', function () {
expect(matchesQuery(player, orQuery)).toBe(true);
});

it('does not match $all query when value is missing', () => {
const player = {
id: new Id('Player', 'P1'),
name: 'Player 1',
score: 12,
};
const q = { missing: { $all: [1, 2, 3] } };
expect(matchesQuery(player, q)).toBe(false);
});

it('matches an $and query', () => {
const player = {
id: new Id('Player', 'P1'),
Expand Down
3 changes: 3 additions & 0 deletions src/LiveQuery/QueryTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ function matchesKeyConstraints(object, key, constraints) {
}
break;
case '$all':
if (!object[key]) {
return false;
}
for (i = 0; i < compareTo.length; i++) {
if (object[key].indexOf(compareTo[i]) < 0) {
return false;
Expand Down

0 comments on commit 213e98e

Please sign in to comment.