Add check for property (#7421)
* Add check for property * updated changelog * Fixed logic returning false positive * Added test case * update change log
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user