-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Allow a query to sort based on an object value field #4805
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
Comments
What error would do you expect? Or would you expect sorting to work on objects? |
one sec and I'll open the pr with the failing test and my proposed solution :). |
Even better :) |
@flovilmart any thoughts on #4806 I'm currently running our production on that branch which ain't a great long-term solution. Anything I can explain as to why its an issue in the first place Some things I'd appreciate your considering: Is there a use case that this change would cause a breakage? is there a use case where my change will allow an introduction of 'bad schema' that could cause mayhem? Is there coverage I could write to test? And finally, any suggestion on who I might ping to look at why Postgress is failing my test and what a solution might be? |
I don’t think it’s a bad idea to introduce sorting on nested keys, Postgres support could come later. It can be gated with it_only_db instead of a simple it. I don’t believe it is something we may regret in then future, however, I’m quite not understanding the change / i believe it’s not the proper resolution :) |
I'll gate the test and add more explanation to the pull request. I agree that it is low risk. Having looked at it, I do think its the right solution, however, I'm super mindful of the fact that my ability to reason about that code is pretty limited :). Thanks! |
CAN we add a small comment as for the change then in the code? So anyone that stumbled upon it is able to get a good idea of what’s going on? |
done. |
Sorting based on object still not working on version 2.8.2. |
@wret However, it does not seem like it's supposed to order by related object's field Tried this and has totally no effect:
@flovilmart @acinader |
Currently, if one tries to sort a query on a field in an object field, parse generates an error:
due to the check in the database controller here:
parse-server/src/Controllers/DatabaseController.js
Line 903 in 3b40d22
This is not the same, though related to: #2113
An example would be an object:
{ sortField: { value: 10 } }
with a Query:
new Parse.Query('Test').addAscending('sortField.value').first()
generates the above error
The text was updated successfully, but these errors were encountered: