Order by json field
See original GitHub issueIs there a way to order by a postgres json field?
Post.findAll({
order: "json_document->>'json_field' ASC"
})
Or something similar. It seems that this is sanitized to the degree that it is not possible, but I could be missing something here.
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
order by JSON data type postgres - Stack Overflow
I want to query the table records and order the results by a value stored in the JSON field. I'm getting the queries...
Read more >JSON Sorter - Sort JSON keys and values online - CodeShack
The purpose of the JSON Sorter tool is to sort key names and key values, this can be both alphabetical and numerical values,...
Read more >Clever way to order a json item by key in postgresql (two ...
jsonitem ) ORDER BY (value->>'key')::int -- true integer sort! ) sub ) arr;. It really depends on where your values come from, what...
Read more >How to Sort MySQL JSON Data Correctly - @jianjye
If you are doing any type of ordering with MySQL JSON especially ... sorting are based on the numeric values of the bytes...
Read more >Sorting JSON structures by multiple fields in JavaScript
If we would like to sort the list only by the word field, here's the simple trick: Array.sort() can take a function as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@janmeier haha i saw that coming. okay i will do it when i’m free.
Never mind. Fixed by using
sequelize.literal
instead.