Skip to content
New issue

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

Sort by property of Json field #24122

Open
fgrande opened this issue May 8, 2024 · 1 comment
Open

Sort by property of Json field #24122

fgrande opened this issue May 8, 2024 · 1 comment
Labels
kind/feature A request for a new feature. team/client Issue for team Client. team/schema Issue for team Schema. topic: Json Scalar type `Json` topic: orderBy / sorting

Comments

@fgrande
Copy link

fgrande commented May 8, 2024

Problem

At the moment looks impossible - through Prisma - to define sort order by property of json field. Postgres allow this with the following syntax (for instance):

select id, "additionalFields"->'jsonProperty'->>'fieldName' from "Table" t
order by "additionalFields"->'jsonProperty'->>'fieldName' desc

Suggested solution

Associate a new SortOrderJson class to json fields, where a property "path" can define the property to sort for

@Druue Druue added kind/feature A request for a new feature. topic: Json Scalar type `Json` topic: orderBy / sorting labels May 8, 2024
@Druue
Copy link
Contributor

Druue commented May 8, 2024

This seems to be possible in our other sql providers as well 👍

@Druue Druue added team/schema Issue for team Schema. team/client Issue for team Client. labels May 8, 2024
@janpio janpio changed the title Sort by property of JSON field Sort by property of Json field May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. team/client Issue for team Client. team/schema Issue for team Schema. topic: Json Scalar type `Json` topic: orderBy / sorting
Projects
None yet
Development

No branches or pull requests

2 participants