We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
*[] | order($orderBy)
I have been looking for a solution for this but it is apparently impossible (or at least very impractical; see below).
For example: *[] | order($orderBy) With params { "orderBy": "createdAt"}
{ "orderBy": "createdAt"}
The only "not-really-a-solution" I found is this:
*[] | order(select( $orderBy == "_createdAt" => _createdAt, _id ))
(context: I am using the plugin sanity-plugin-documents-pane and the Sanity studio crashed when trying to do the same for asc)
sanity-plugin-documents-pane
asc
This is deeply impractical.
Improvements I can come up with:
*[] | order(unquote($orderBy))
*[] | order(@[$orderBy])
Or
*[] { ...@, "temp": @[$orderBy], } | order(temp)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have been looking for a solution for this but it is apparently impossible (or at least very impractical; see below).
For example:
*[] | order($orderBy)
With params
{ "orderBy": "createdAt"}
The only "not-really-a-solution" I found is this:
(context: I am using the plugin
sanity-plugin-documents-pane
and the Sanity studio crashed when trying to do the same forasc
)This is deeply impractical.
Improvements I can come up with:
*[] | order(unquote($orderBy))
*[] | order(@[$orderBy])
Or
The text was updated successfully, but these errors were encountered: