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

Preview feature feedback: Order by Relations support (orderByRelation) #5438

Closed
Tracked by #8628
matthewmueller opened this issue Feb 3, 2021 · 5 comments
Closed
Tracked by #8628
Labels
kind/feedback Issue for gathering feedback. team/client Issue for team Client. topic: orderByRelation topic: previewFeatures Issue touches on an preview feature flag

Comments

@matthewmueller
Copy link
Contributor

matthewmueller commented Feb 3, 2021

Please share your feedback about the orderByRelation functionality that was released in v2.16.0 in this issue.

  • If you encounter a bug, please open a bug report in this repo.
  • If the feature is working well for you, please share this in a comment below or leave a 👍 on this issue.

If you have any questions, don't hesitate to ask them in the #prisma-client channel in the Prisma Slack.

@matthewmueller matthewmueller added kind/feedback Issue for gathering feedback. topic: orderByRelation topic: previewFeatures Issue touches on an preview feature flag labels Feb 3, 2021
@albertoperdomo albertoperdomo added the team/client Issue for team Client. label Feb 11, 2021
@matthewmueller matthewmueller changed the title Preview feature feedback: Order by Relations support (orderByRelations) Preview feature feedback: Order by Relations support (orderByRelation) Mar 10, 2021
@guerrerocarlos
Copy link

The feature is working great, but if it could not only count the number of relations, but also sum, avg, min and max some specific attribute of the relations, it would make it a killer feature.

For example, a very common use case:

Top 10 students with the best grades

await prisma.students.findMany({
  take: 10,
  orderBy: {
    exams: {
      avg: {
        points: 'desc' 
      }
    }
  },
});

@Brandejs
Copy link

Brandejs commented May 27, 2021

Hi,

I prepare a simple project. There are 3 entities with composite keys. The last entity (TASK) has reference to Company and Project. I Can order tasks by CompanyName, but I cannot order them by ProjectName.

prismaClientUnknownRequestError2 [PrismaClientUnknownRequestError]: Invalidprisma.task.findMany() invocation: Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42804"), message: "argument of JOIN/ON must be type boolean, not type record", detail: None, hint: None, position: Some(Original(383)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_coerce.c"), line: Some(1156), routine: Some("coerce_to_boolean") }) }) }) at cb (/prisma-schema-orderby/node_modules/@prisma/client/runtime/index.js:35105:17) at processTicksAndRejections (internal/process/task_queues.js:93:5) { clientVersion: '2.23.0' }

ISSUE: #7331

@janpio
Copy link
Member

janpio commented May 28, 2021

Can you split that into a new issue @Brandejs and also include the information asked for in the bug report template? That would be awesome. Thanks!

@andresribeiro
Copy link

For me it doesn't work very well with skip. Not that this is a bug, but when the relation has the same quantity the order of the objects in the response may vary. I think this will only be solved when it becomes possible to sort by multiple fields

@janpio janpio added this to the 2.31.0 / 3.0.x milestone Aug 19, 2021
@2color
Copy link
Contributor

2color commented Sep 7, 2021

Closing this now that this has been released to General Availability in the 3.0.1 release

@2color 2color closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feedback Issue for gathering feedback. team/client Issue for team Client. topic: orderByRelation topic: previewFeatures Issue touches on an preview feature flag
Projects
None yet
Development

No branches or pull requests

7 participants