Skip to content
Merged
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
daaeed8
fix: mongodb-runner usage and default version to 6.0.2
Moumouls Oct 26, 2024
5811465
fix: json
Moumouls Oct 26, 2024
6e89fd1
feat: parallel include
Moumouls Oct 28, 2024
28ffcd7
Merge branch 'alpha' of github.com:parse-community/parse-server into …
Moumouls Sep 13, 2025
328a4be
Merge branch 'alpha' of github.com:parse-community/parse-server into …
Moumouls Nov 8, 2025
8b99dc5
feat: add test to battle test include
Moumouls Nov 8, 2025
d854752
Merge branch 'alpha' into moumouls/concurrent-include
Moumouls Nov 8, 2025
c613e3f
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 8, 2025
af50fd3
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 9, 2025
87339eb
add perf test
mtrezza Nov 9, 2025
2618e96
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 9, 2025
e46dba6
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 9, 2025
b7c919d
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 9, 2025
d432e4c
less verbose
mtrezza Nov 9, 2025
bb74681
db proxy
mtrezza Nov 9, 2025
0bef43f
refactor
mtrezza Nov 9, 2025
97bb64b
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 9, 2025
713a4d0
remove proxy
mtrezza Nov 9, 2025
0e17c8f
fix
mtrezza Nov 9, 2025
35f1809
Merge branch 'moumouls/concurrent-include' of https://github.com/Moum…
mtrezza Nov 9, 2025
96e8f1f
logging
mtrezza Nov 9, 2025
375c807
db latency
mtrezza Nov 9, 2025
b8ccc4a
Update MongoLatencyWrapper.js
mtrezza Nov 16, 2025
6840b60
schema concurrency fix
mtrezza Nov 16, 2025
523b886
Revert "schema concurrency fix"
mtrezza Nov 16, 2025
e4dbfdf
all benchmarks
mtrezza Nov 16, 2025
735d506
faster
mtrezza Nov 16, 2025
199b726
Merge branch 'alpha' into moumouls/concurrent-include
mtrezza Nov 17, 2025
170ce00
fix
mtrezza Nov 17, 2025
24312ec
fix benchmark
mtrezza Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 41 additions & 20 deletions src/RestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,31 +856,54 @@ _UnsafeRestQuery.prototype.handleExcludeKeys = function () {
};

// Augments this.response with data at the paths provided in this.include.
_UnsafeRestQuery.prototype.handleInclude = function () {
_UnsafeRestQuery.prototype.handleInclude = async function () {
if (this.include.length == 0) {
return;
}

var pathResponse = includePath(
this.config,
this.auth,
this.response,
this.include[0],
this.context,
this.restOptions
);
if (pathResponse.then) {
return pathResponse.then(newResponse => {
this.response = newResponse;
this.include = this.include.slice(1);
return this.handleInclude();
const indexedResults = this.response.results.reduce((indexed, result, i) => {
indexed[result.objectId] = i;
return indexed;
}, {});

// Build the execution tree
const executionTree = {}
this.include.forEach(path => {
let current = executionTree;
path.forEach((node) => {
if (!current[node]) {
current[node] = {
path,
children: {}
};
}
current = current[node].children
});
} else if (this.include.length > 0) {
this.include = this.include.slice(1);
return this.handleInclude();
});

const recursiveExecutionTree = async (treeNode) => {
const { path, children } = treeNode;
const pathResponse = includePath(
this.config,
this.auth,
this.response,
path,
this.context,
this.restOptions,
this,
);
if (pathResponse.then) {
const newResponse = await pathResponse
newResponse.results.forEach(newObject => {
// We hydrate the root of each result with sub results
this.response.results[indexedResults[newObject.objectId]][path[0]] = newObject[path[0]];
})
}
return Promise.all(Object.values(children).map(recursiveExecutionTree));
}

return pathResponse;
await Promise.all(Object.values(executionTree).map(recursiveExecutionTree));
this.include = []
};

//Returns a promise of a processed set of results
Expand Down Expand Up @@ -1018,7 +1041,6 @@ function includePath(config, auth, response, path, context, restOptions = {}) {
} else if (restOptions.readPreference) {
includeRestOptions.readPreference = restOptions.readPreference;
}

const queryPromises = Object.keys(pointersHash).map(async className => {
const objectIds = Array.from(pointersHash[className]);
let where;
Expand Down Expand Up @@ -1057,7 +1079,6 @@ function includePath(config, auth, response, path, context, restOptions = {}) {
}
return replace;
}, {});

var resp = {
results: replacePointers(response.results, path, replace),
};
Expand Down
Loading