parse-server
parse-server copied to clipboard
fix: mongo explain queries should always return as an array of results
New Pull Request Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am creating this PR in reference to #7442.
Issue Description
explain for mongo is currently returning an object when returning results. This conflicts with trying to decode explain results because it should return an array of objects when using find instead of a single object.
This error was probably not seen before because JS and some other languages are "not strongly typed," meaning the language doesn't care if a single object is returned instead of an array of objects. This is not the case with the Swift SDK.
This also requires a fix to the JS SDK for proper support along with any other SDK that adapted to the bug.
This will be a breaking change as devs who use mongo probably programmed to the bug mentioned above. Close #7442
Originally discussed on community.parseplatform.org
Related issue: #7442
Approach
Make find in the MongoStorageAdapter return an array of objects to conform to the way it's suppose to return results.
TODOs before merging
- [x] Fix current test cases that were adapted to bug
- [x] Add entry to changelog
Codecov Report
Merging #7440 (7a40fa0) into alpha (45d29cc) will decrease coverage by
0.02%. The diff coverage is100.00%.
@@ Coverage Diff @@
## alpha #7440 +/- ##
==========================================
- Coverage 93.93% 93.90% -0.03%
==========================================
Files 181 181
Lines 13267 13267
==========================================
- Hits 12462 12459 -3
- Misses 805 808 +3
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Adapters/Storage/Mongo/MongoStorageAdapter.js | 92.37% <100.00%> (ø) |
|
| src/Adapters/Files/GridFSBucketAdapter.js | 79.50% <0.00%> (-0.82%) |
:arrow_down: |
| src/RestWrite.js | 93.76% <0.00%> (-0.32%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 45d29cc...7a40fa0. Read the comment docs.
I'll submit the JS fix later today as that will be needed for the test cases. Essentially, an explainable first is needed.
⚠️ Important change for merging PRs from Parse Server 5.0 onwards!
We are planning to release the first beta version of Parse Server 5.0 in October 2021.
If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.
One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.
We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.
If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.
Thanks for your contribution and support during this transition to Parse Server release automation!
Concerted to draft:
- If this means a breaking change, we may as well break for a more sustainable solution, see https://github.com/parse-community/parse-server/pull/7440#discussion_r678916891.
- We don't introduce breaking changes this way anymore, we'd phase them in if possible.
Thanks for opening this pull request!
- 🎉 We are excited about your hands-on contribution!