question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting default sorting order for graphql responses

See original GitHub issue

When create table or modifying table, we should allow specifying default sorting columns.

For example, all my tables have created_at columns, i’d love to set created_at as default order when querying.

Multiple columns default sorting should be allowed, too.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rikinskcommented, Apr 15, 2020

I cannot think of any specific tooling more helpul than the usual graphql libraries used to parse GraphQL queries. Maybe you could ask the Hasura community if they have any smarter solutions. You can join our discord server via https://discord.gg/vBPpJkS if you havent already 😃

1reaction
revskill10commented, Jul 11, 2019

@rikinsk The problem is simple.

WIth current query

users {
id
first_name
last_name
created_at
}

What will be the order of results ?

In this case, i’d love to force the default order returning by query above to be set to created_at: asc_nulls_last, for example.

This is about graphql API query, not console.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Graphql default order change - Storyblok
In this query example the items inside “desktop_navigation_items” (Multi-options field) are sorted by the order they are visible in the content ...
Read more >
GraphQL query with sorting by date - JavaScript - Amplify Docs
In our example, you will implement sorting results by date in either an ascending or descending order by implementing an additional data access...
Read more >
Order and Pagination - GraphQL - Dgraph
Every type with fields whose types can be ordered ( Int , Float , String , DateTime ) gets ordering built into the...
Read more >
GraphQL Filtering, Pagination & Sorting Tutorial with JavaScript
Filtering, Pagination & Sorting ; Go ahead and add the filter string to the feed query in your application schema: · ) ;...
Read more >
Postgres: Sort query results | Hasura GraphQL Docs
The sort order (ascending vs. descending) is set by specifying the asc or desc enum value for the column name in the order_by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found