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.

Add support for sorting by json path

See original GitHub issue

It would be nice to have the ability to sort the query results by a path of a JSON columns For example, for a table like

CREATE TABLE products (
  id serial NOT NULL PRIMARY KEY,
  translated_name jsonb NULL
);

I would like to have the ability to do something like

query productsSortedByName {
    products(order_by: {translated_name: {path: "en", how: asc_nulls_last}}) {
       id
       name: translated_name (path: "en")
   }
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:43
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
kmclaughcommented, Jan 28, 2020

At the very least, we should be able to sort by a named path

so for a data jsonb column like this data: { "amount": 10 } and a query like this sometable { timestamp data amount: data(path: "amount") } You could sort by this "orderBy": [{"amount": "asc"}]

1reaction
pi-benoitcommented, Mar 15, 2022

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to get a sorted list of attribute values from a JSON ...
This is a source I found suggesting sorting is supported but it might be product-specific? I'm using http://www.jsonquerytool.com/ to test this.
Read more >
JSONPath — Gabbi documentation
JSONPath expressions are provided by jsonpath_rw, with jsonpath_rw_ext custom extensions to address common requirements: Sorting via sorted and [/property] .
Read more >
JSONPath Support - Kubernetes
JSONPath Support · Use double quotes to quote text inside JSONPath expressions. · Use the range , end operators to iterate lists. ·...
Read more >
Sorting, Grouping and Aggregation · JSONata
The order-by operator is a convenient syntax that can used directly in a path expression to sort the result sequences in ascending or...
Read more >
Working with data and jsonpaths | Tray.io Documentation
When you are wanting to 'pull' data from one service in order to 'push' it ... can determine the prefix for a jsonpath...
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