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

Support orderBy nulls for relational fields #19761

Open
Weakky opened this issue Jun 14, 2023 · 1 comment
Open

Support orderBy nulls for relational fields #19761

Weakky opened this issue Jun 14, 2023 · 1 comment
Labels
kind/feature A request for a new feature. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: null topic: orderBy / sorting topic: orderByNulls `{ sort: 'asc', nulls: 'last' }` and similar topic: orderByRelation

Comments

@Weakky
Copy link
Member

Weakky commented Jun 14, 2023

Problem

It's currently impossible to order by null on relational field.

Suggested solution

model Post {
  id Int @id
  title String

  authorId Int
  author User @relation(
}

model Author {
  id Int @id
  name String?
}
await prisma.post.findMany({
  orderBy: { author: { name: { sort: 'asc', nulls: 'last' } } }
})
@Weakky Weakky added kind/feature A request for a new feature. tech/engines Issue for tech Engines. topic: null topic: orderByRelation topic: orderBy / sorting topic: orderByNulls `{ sort: 'asc', nulls: 'last' }` and similar labels Jun 14, 2023
@janpio janpio changed the title Suport orderBy nulls for relational fields Support orderBy nulls for relational fields Jun 14, 2023
@Druue Druue added the team/client Issue for team Client. label Jun 16, 2023
@henrymcl
Copy link

henrymcl commented Mar 3, 2024

this would really help

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. tech/engines Issue for tech Engines. topic: null topic: orderBy / sorting topic: orderByNulls `{ sort: 'asc', nulls: 'last' }` and similar topic: orderByRelation
Projects
None yet
Development

No branches or pull requests

3 participants