Skip to content

Commit 7556e8e

Browse files
authored
Merge branch 'alpha' into create-config
2 parents 3b72adb + b54af6b commit 7556e8e

File tree

9 files changed

+129
-56
lines changed

9 files changed

+129
-56
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,16 @@ jobs:
141141
MONGODB_TOPOLOGY: replicaset
142142
MONGODB_STORAGE_ENGINE: wiredTiger
143143
NODE_VERSION: 18.1.0
144-
- name: MongoDB 5.3, ReplicaSet, WiredTiger
144+
- name: MongoDB 5, ReplicaSet, WiredTiger
145145
MONGODB_VERSION: 5.3.2
146146
MONGODB_TOPOLOGY: replicaset
147147
MONGODB_STORAGE_ENGINE: wiredTiger
148148
NODE_VERSION: 18.1.0
149+
- name: MongoDB 6, ReplicaSet, WiredTiger
150+
MONGODB_VERSION: 6.0.2
151+
MONGODB_TOPOLOGY: replicaset
152+
MONGODB_STORAGE_ENGINE: wiredTiger
153+
NODE_VERSION: 18.1.0
149154
- name: Redis Cache
150155
PARSE_SERVER_TEST_CACHE: redis
151156
MONGODB_VERSION: 4.4.13

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases)
99

1010
[![Node Version](https://img.shields.io/badge/nodejs-12,_14,_16,_17,_18-green.svg?logo=node.js&style=flat)](https://nodejs.org)
11-
[![MongoDB Version](https://img.shields.io/badge/mongodb-4.0,_4.2,_4.4,_5.0,_5.1,_5.2-green.svg?logo=mongodb&style=flat)](https://www.mongodb.com)
11+
[![MongoDB Version](https://img.shields.io/badge/mongodb-4.0,_4.2,_4.4,_5,_6-green.svg?logo=mongodb&style=flat)](https://www.mongodb.com)
1212
[![Postgres Version](https://img.shields.io/badge/postgresql-11,_12,_13,_14,_15-green.svg?logo=postgresql&style=flat)](https://www.postgresql.org)
1313

1414
[![npm latest version](https://img.shields.io/npm/v/parse-server/latest.svg)](https://www.npmjs.com/package/parse-server)
@@ -141,8 +141,8 @@ Parse Server is continuously tested with the most recent releases of MongoDB to
141141
| MongoDB 4.0 | 4.0.28 | April 2022 | ✅ Yes |
142142
| MongoDB 4.2 | 4.2.19 | April 2023 | ✅ Yes |
143143
| MongoDB 4.4 | 4.4.13 | February 2024 | ✅ Yes |
144-
| MongoDB 5.3 | 5.3.2 | October 2024 | ✅ Yes |
145-
| MongoDB 6.0 | - | July 2025 | ❌ Not tested |
144+
| MongoDB 5 | 5.3.2 | October 2024 | ✅ Yes |
145+
| MongoDB 6 | 6.0.2 | July 2025 | ✅ Yes |
146146

147147
#### PostgreSQL
148148

changelogs/CHANGELOG_alpha.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [5.3.0-alpha.31](https://github.com/parse-community/parse-server/compare/5.3.0-alpha.30...5.3.0-alpha.31) (2022-10-24)
2+
3+
4+
### Bug Fixes
5+
6+
* relation constraints in compound queries `Parse.Query.or`, `Parse.Query.and` not working ([#8203](https://github.com/parse-community/parse-server/issues/8203)) ([28f0d26](https://github.com/parse-community/parse-server/commit/28f0d2667787d2ac68726607b811d6f0ef62b9f1))
7+
8+
# [5.3.0-alpha.30](https://github.com/parse-community/parse-server/compare/5.3.0-alpha.29...5.3.0-alpha.30) (2022-10-17)
9+
10+
11+
### Features
12+
13+
* add support for MongoDB 6 ([#8242](https://github.com/parse-community/parse-server/issues/8242)) ([aba0081](https://github.com/parse-community/parse-server/commit/aba0081ce1a166a93de57f3928c19a05562b5cc1))
14+
115
# [5.3.0-alpha.29](https://github.com/parse-community/parse-server/compare/5.3.0-alpha.28...5.3.0-alpha.29) (2022-10-15)
216

317

package-lock.json

Lines changed: 39 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "5.3.0-alpha.29",
3+
"version": "5.3.0-alpha.31",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {
@@ -46,7 +46,7 @@
4646
"mongodb": "4.10.0",
4747
"mustache": "4.2.0",
4848
"parse": "3.4.2",
49-
"pg-monitor": "1.4.1",
49+
"pg-monitor": "1.5.0",
5050
"pg-promise": "10.12.0",
5151
"pluralize": "8.0.0",
5252
"redis": "3.1.2",
@@ -56,7 +56,7 @@
5656
"uuid": "9.0.0",
5757
"winston": "3.8.1",
5858
"winston-daily-rotate-file": "4.7.1",
59-
"ws": "8.8.1"
59+
"ws": "8.9.0"
6060
},
6161
"devDependencies": {
6262
"graphql-tag": "2.12.6",
@@ -119,6 +119,7 @@
119119
"test:mongodb:4.2.19": "npm run test:mongodb --dbversion=4.2.19",
120120
"test:mongodb:4.4.13": "npm run test:mongodb --dbversion=4.4.13",
121121
"test:mongodb:5.3.2": "npm run test:mongodb --dbversion=5.3.2",
122+
"test:mongodb:6.0.2": "npm run test:mongodb --dbversion=6.0.2",
122123
"posttest:mongodb": "mongodb-runner stop",
123124
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=5.3.2} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} mongodb-runner start",
124125
"testonly": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=5.3.2} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} TESTING=1 jasmine",

spec/MongoStorageAdapter.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
308308
await expectAsync(adapter.getClass('UnknownClass')).toBeRejectedWith(undefined);
309309
});
310310

311-
it_only_mongodb_version('<5.1')('should use index for caseInsensitive query', async () => {
311+
it_only_mongodb_version('<5.1>=6')('should use index for caseInsensitive query', async () => {
312312
const user = new Parse.User();
313313
user.set('username', 'Bugs');
314314
user.set('password', 'Bunny');
@@ -342,7 +342,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
342342
expect(postIndexPlan.executionStats.executionStages.stage).toBe('FETCH');
343343
});
344344

345-
it_only_mongodb_version('>=5.1')('should use index for caseInsensitive query', async () => {
345+
it_only_mongodb_version('>=5.1<6')('should use index for caseInsensitive query', async () => {
346346
const user = new Parse.User();
347347
user.set('username', 'Bugs');
348348
user.set('password', 'Bunny');

spec/ParseQuery.hint.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
2727
await TestUtils.destroyAllDataPermanently(false);
2828
});
2929

30-
it_only_mongodb_version('<5.1')('query find with hint string', async () => {
30+
it_only_mongodb_version('<5.1>=6')('query find with hint string', async () => {
3131
const object = new TestObject();
3232
await object.save();
3333

@@ -39,7 +39,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
3939
expect(explain.queryPlanner.winningPlan.inputStage.indexName).toBe('_id_');
4040
});
4141

42-
it_only_mongodb_version('>=5.1')('query find with hint string', async () => {
42+
it_only_mongodb_version('>=5.1<6')('query find with hint string', async () => {
4343
const object = new TestObject();
4444
await object.save();
4545

@@ -50,7 +50,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
5050
expect(explain.queryPlanner.winningPlan.queryPlan.inputStage.indexName).toBe('_id_');
5151
});
5252

53-
it_only_mongodb_version('<5.1')('query find with hint object', async () => {
53+
it_only_mongodb_version('<5.1>=6')('query find with hint object', async () => {
5454
const object = new TestObject();
5555
await object.save();
5656

@@ -64,7 +64,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
6464
});
6565
});
6666

67-
it_only_mongodb_version('>=5.1')('query find with hint object', async () => {
67+
it_only_mongodb_version('>=5.1<6')('query find with hint object', async () => {
6868
const object = new TestObject();
6969
await object.save();
7070

@@ -265,7 +265,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
265265
expect(queryPlanner.winningPlan.queryPlan.inputStage.inputStage.keyPattern).toEqual({ _id: 1 });
266266
});
267267

268-
it_only_mongodb_version('<5.1')('query find with hint (rest)', async () => {
268+
it_only_mongodb_version('<5.1>=6')('query find with hint (rest)', async () => {
269269
const object = new TestObject();
270270
await object.save();
271271
let options = Object.assign({}, masterKeyOptions, {
@@ -290,7 +290,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
290290
expect(explain.queryPlanner.winningPlan.inputStage.inputStage.indexName).toBe('_id_');
291291
});
292292

293-
it_only_mongodb_version('>=5.1')('query find with hint (rest)', async () => {
293+
it_only_mongodb_version('>=5.1<6')('query find with hint (rest)', async () => {
294294
const object = new TestObject();
295295
await object.save();
296296
let options = Object.assign({}, masterKeyOptions, {

spec/ParseRelation.spec.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,49 @@ describe('Parse.Relation testing', () => {
410410
});
411411
});
412412

413+
it('or queries with base constraint on relation field', async () => {
414+
const ChildObject = Parse.Object.extend('ChildObject');
415+
const childObjects = [];
416+
for (let i = 0; i < 10; i++) {
417+
childObjects.push(new ChildObject({ x: i }));
418+
}
419+
await Parse.Object.saveAll(childObjects);
420+
const ParentObject = Parse.Object.extend('ParentObject');
421+
const parent = new ParentObject();
422+
parent.set('x', 4);
423+
const relation = parent.relation('toChilds');
424+
relation.add(childObjects[0]);
425+
relation.add(childObjects[1]);
426+
relation.add(childObjects[2]);
427+
428+
const parent2 = new ParentObject();
429+
parent2.set('x', 3);
430+
const relation2 = parent2.relation('toChilds');
431+
relation2.add(childObjects[0]);
432+
relation2.add(childObjects[1]);
433+
relation2.add(childObjects[2]);
434+
435+
const parents = [];
436+
parents.push(parent);
437+
parents.push(parent2);
438+
parents.push(new ParentObject());
439+
440+
await Parse.Object.saveAll(parents);
441+
const query1 = new Parse.Query(ParentObject);
442+
query1.equalTo('x', 4);
443+
const query2 = new Parse.Query(ParentObject);
444+
query2.equalTo('x', 3);
445+
446+
const query = Parse.Query.or(query1, query2);
447+
query.equalTo('toChilds', childObjects[2]);
448+
449+
const list = await query.find();
450+
const objectIds = list.map(item => item.id);
451+
expect(objectIds.indexOf(parent.id)).not.toBe(-1);
452+
expect(objectIds.indexOf(parent2.id)).not.toBe(-1);
453+
equal(list.length, 2, 'There should be 2 results');
454+
});
455+
413456
it('Get query on relation using un-fetched parent object', done => {
414457
// Setup data model
415458
const Wheel = Parse.Object.extend('Wheel');

src/Controllers/DatabaseController.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -929,32 +929,32 @@ class DatabaseController {
929929
reduceInRelation(className: string, query: any, schema: any): Promise<any> {
930930
// Search for an in-relation or equal-to-relation
931931
// Make it sequential for now, not sure of paralleization side effects
932+
const promises = [];
932933
if (query['$or']) {
933934
const ors = query['$or'];
934-
return Promise.all(
935-
ors.map((aQuery, index) => {
935+
promises.push(
936+
...ors.map((aQuery, index) => {
936937
return this.reduceInRelation(className, aQuery, schema).then(aQuery => {
937938
query['$or'][index] = aQuery;
938939
});
939940
})
940-
).then(() => {
941-
return Promise.resolve(query);
942-
});
941+
);
943942
}
944943
if (query['$and']) {
945944
const ands = query['$and'];
946-
return Promise.all(
947-
ands.map((aQuery, index) => {
945+
promises.push(
946+
...ands.map((aQuery, index) => {
948947
return this.reduceInRelation(className, aQuery, schema).then(aQuery => {
949948
query['$and'][index] = aQuery;
950949
});
951950
})
952-
).then(() => {
953-
return Promise.resolve(query);
954-
});
951+
);
955952
}
956953

957-
const promises = Object.keys(query).map(key => {
954+
const otherKeys = Object.keys(query).map(key => {
955+
if (key === '$and' || key === '$or') {
956+
return;
957+
}
958958
const t = schema.getExpectedType(className, key);
959959
if (!t || t.type !== 'Relation') {
960960
return Promise.resolve(query);
@@ -1016,7 +1016,7 @@ class DatabaseController {
10161016
});
10171017
});
10181018

1019-
return Promise.all(promises).then(() => {
1019+
return Promise.all([...promises, ...otherKeys]).then(() => {
10201020
return Promise.resolve(query);
10211021
});
10221022
}

0 commit comments

Comments
 (0)