Allow the classic natural sort on string columns
See original GitHub issueProblem
There is often a need to do natural sort on string columns. Machines’ sort is not always sensible for humans. https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
Prisma doesn’t support this currently in v2.7.1
.
Suggested solution
Either configured at schema level for the desired column, or by passing a param to orderBy
.
Alternatives
Discussed https://github.com/prisma/prisma/discussions/3693
Additional context
ASC (12
should be the last one!)
DESC (6
should be the last one!)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:7 (2 by maintainers)
Top Results From Across the Web
PostgreSQL ORDER BY issue - natural sort - Stack Overflow
-- First create a collation with numeric sorting CREATE COLLATION numeric (provider = icu, locale = 'en@colNumeric=yes'); -- Alter table to use the...
Read more >How to Sort Mixed Numbers and Text Using String Functions
Learn how to sort alphanumeric data like employee numbers with complete control using Excel functions including FIND, LEN, MID, LEFT, RIGHT, and VALUE....
Read more >Natural sort order for text - Microsoft Power BI Community
Is there a simple way to sort data in a natural order in PowerBI? i.e. being able to sort a text column to...
Read more >Use numeric sorting rather than literal sorting - NI Community
There could also be a specialised string sort function which takes in a string array and provides an option for a numeric or...
Read more >Nature sorting in UI for ASP.NET AJAX | Telerik Forums
Hi, I want to make a multiple sorting + natural sorting column. ... to maintain and to allow multi-column sorting with custom handling: ......
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 FreeTop 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
Top GitHub Comments
Today, I find out this answer: https://stackoverflow.com/a/67975489/329424 If you use Postgresql then it can be sort natural by default.
@janpio but
$queryRaw
doesn’t handle plat to nested data. This is what I am using for my website:I find libs that could convert plat to nest data but there is no good library.
Knex don’t do it too. I dunno how everyone use knex. There may be some things that I don’t know about.