Skip to content

#4678: Converting strings to Date when schema.type is Date within agg… #4743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 26, 2018
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fa8c902
#4678: Converting strings to Date when schema.type is Date within agg…
cjbland Apr 30, 2018
9a12b7c
Added test cases to test new date match aggregate query
cjbland Apr 30, 2018
044453a
Added function to parse match aggregate arguments and convert necessa…
cjbland May 1, 2018
90b43ba
Merge branch 'master' into fix/4678
cjbland May 1, 2018
1714711
Added missing return value
cjbland May 2, 2018
867863e
Merge branch 'fix/4678' of https://github.com/cjbland/parse-server in…
cjbland May 2, 2018
d922a7a
Improved code quality based on suggestions and figured out why tests …
cjbland May 4, 2018
7261ba0
Added tests from @dplewis
cjbland May 19, 2018
beb54bb
Supporting project aggregation as well as exists operator
cjbland May 19, 2018
403e81b
Merge branch 'master' into fix/4678
cjbland May 19, 2018
9526c65
Merge branch 'master' into fix/4678
cjbland May 19, 2018
7993f45
Merge branch 'fix/4678' of https://github.com/cjbland/parse-server in…
cjbland May 19, 2018
f8c06d9
Merge branch 'master' into fix/4678
cjbland May 22, 2018
abf42d9
Excluding exists match for postgres
cjbland May 23, 2018
f7edfa5
Merge branch 'master' into fix/4678
cjbland Jun 16, 2018
cdc90e2
Merge branch 'master' into fix/4678
cjbland Jun 16, 2018
52b2f7f
Merge branch 'fix/4678' of https://github.com/cjbland/parse-server in…
cjbland Jun 16, 2018
ae3ce3b
Merge branch 'master' into fix/4678
cjbland Jun 18, 2018
da3afbb
Handling the $group operator similar to $match and $project
cjbland Jun 19, 2018
a7c428d
Added more tests for better code coverage
cjbland Jun 20, 2018
cc25079
Excluding certain tests from being run on postgres
cjbland Jun 20, 2018
1a51a82
Excluding one more test from postgres
cjbland Jun 21, 2018
af531c1
clean up
dplewis Jun 24, 2018
6b8fded
Merge branch 'master' into fix/4678
dplewis Jun 26, 2018
f8d7826
Merge branch 'master' into fix/4678
dplewis Jun 26, 2018
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
16 changes: 16 additions & 0 deletions src/Adapters/Storage/Mongo/MongoStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,28 @@ export class MongoStorageAdapter implements StorageAdapter {
const transformMatch = { [`_p_${field}`] : `${schema.fields[field].targetClass}$${stage.$match[field]}` };
stage.$match = transformMatch;
}
else if (schema.fields[field] && schema.fields[field].type === 'Date') {
const transformMatch = { [`${field}`]: new Date(stage.$match[field]) };
stage.$match = transformMatch;
}
if (field === 'objectId') {
const transformMatch = Object.assign({}, stage.$match);
transformMatch._id = stage.$match[field];
delete transformMatch.objectId;
stage.$match = transformMatch;
}
else if (field === 'createdAt') {
const transformMatch = Object.assign({}, stage.$match);
transformMatch._created_at = stage.$match[field];
delete transformMatch.createdAt;
stage.$match = transformMatch;
}
else if (field === 'updatedAt') {
const transformMatch = Object.assign({}, stage.$match);
transformMatch._updated_at = stage.$match[field];
delete transformMatch.updatedAt;
stage.$match = transformMatch;
}
}
}
return stage;
Expand Down