-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix: Parse.Query.distinct
fails due to invalid aggregate stage 'hint'
#9295
fix: Parse.Query.distinct
fails due to invalid aggregate stage 'hint'
#9295
Conversation
Thanks for opening this pull request! |
Parse.Query.distinct
fails due to invalid aggregate stage 'hint'
So this test looks good, we just need to the fix for it. |
Interesting, could you explain the last commit? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## alpha #9295 +/- ##
=======================================
Coverage 93.48% 93.48%
=======================================
Files 186 186
Lines 14811 14812 +1
=======================================
+ Hits 13846 13847 +1
Misses 965 965 ☔ View full report in Codecov by Sentry. |
What happens is the Parse JS SDK sends the data directly to the AggregateRouter without it being sent over http (which removes undefined properties from the request). It has code where it sets hint with value undefined to query body by default. So when that check is made it doesn't pass as hint is undefined and the property is never deleted from the object. When it goes to the aggregatePipeline it finds it on the body and throws an error. What I did was checking if the object has that property to make sure it gets deleted wether it has value or not and assign that property to the options object only if it's truthy. https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src%2FParseQuery.ts#L820-L827 |
Does that mean that we missed something in d0d30c4? I mean is this PR treating merely the symptom, or is it the actual root cause that gets fixed? |
Nothing is missing parse-server/src/Adapters/Storage/Mongo/MongoCollection.js Lines 16 to 47 in dfd5a8e
parse-server/src/Adapters/Storage/Mongo/MongoCollection.js Lines 89 to 111 in dfd5a8e
|
# [7.4.0-alpha.4](7.4.0-alpha.3...7.4.0-alpha.4) (2024-10-22) ### Bug Fixes * `Parse.Query.distinct` fails due to invalid aggregate stage 'hint' ([#9295](#9295)) ([5f66c6a](5f66c6a))
🎉 This change has been released in version 7.4.0-alpha.4 |
Pull Request
Issue
Closes: #8804
Approach
When directAccess is set to true and a distinct query is made within an eachBatch query an
Error: Invalid aggregate stage 'hint'.
is thrown.Tasks