parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

fix: Queries fail on nested date attributes

Open hariprasadiit opened this issue 4 years ago • 9 comments
trafficstars

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [x] I am creating this PR in reference to an issue.

Issue Description

Queries return empty results if nested date attributes are used in constraints

Related issue: #7575

Approach

MongoDB transformer was implemented to only transform root level attributes and leave nested attributes as it is except Date and Bytes. There was inconsistency between transformQueryKeyValue and parseObjectToMongoObjectForCreate which was causing some nested date queries to fail. following changes are made to fix it.

  1. Don't transform nested Date types
  2. Don't transform query constraints, where key is a path, like rootProp.nestedProp .

TODOs before merging

  • [x] Add test cases
  • [x] Add entry to changelog

hariprasadiit avatar Sep 19 '21 17:09 hariprasadiit

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (679c61d) 94.13% compared to head (572dabf) 84.86%. Report is 289 commits behind head on alpha.

:exclamation: Current head 572dabf differs from pull request most recent head 433de1a. Consider uploading reports for the commit 433de1a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #7582      +/-   ##
==========================================
- Coverage   94.13%   84.86%   -9.28%     
==========================================
  Files         182      183       +1     
  Lines       13785    13624     -161     
==========================================
- Hits        12977    11562    -1415     
- Misses        808     2062    +1254     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 24 '21 14:09 codecov[bot]

I will reformat the title to use the proper commit message syntax.

Could you look at the failing postgres tests? I seems the postgres adapter needs some changes too? And could you delete the TODOs at the top that don't apply here?

mtrezza avatar Oct 09 '21 12:10 mtrezza

I'm not very familiar with PostgreSQL. I'll take a dig at it and see if I can figure it out.

hariprasadiit avatar Oct 09 '21 12:10 hariprasadiit

Do you need a hand with Postgres?

mtrezza avatar Oct 15 '21 09:10 mtrezza

Sorry for the delay. I'm busy with some company work now. I'll take a look as soon as I can

hariprasadiit avatar Oct 15 '21 11:10 hariprasadiit

I've gone through PostgresStorageAdapter. Based on what I understood, iso of date type is being used in queries, so it should work but it's not. Maybe I'm missing something.

Help would be appreciated as I'm not familiar with Postgres

hariprasadiit avatar Nov 10 '21 09:11 hariprasadiit

I will reformat the title to use the proper commit message syntax.