-
Notifications
You must be signed in to change notification settings - Fork 863
Order by related fields #95
Order by related fields #95
Comments
This would be a lifesaver! |
@marktani any workaround we can use for the time being? |
The best workaround I'm aware of, is to order items client side 🙂 |
It would be great to be able to order by "to-many" related fields as well (by the count of related items). For example, to get a list of the top 10 most voted-for links (assuming
Currently, to get that list you'd have to query for every Link and then sort/slice it on the client, which is potentially a ton of overfetching. |
A question for when they plan to add this improvement? |
+1 for this |
+1 |
1 similar comment
+1 |
I see a lot of 👍 |
Must-have feature! |
@danielrasmuson you can create some sortable index just as temporary solution :) |
Have a look at #62 query{
servers(
orderBy: {
active: DESC
assetNumber: ASC
customer: {
name:ASC
}
}
) {
id
active
assetNumber
customer {
name
}
}
} |
+1 |
1 similar comment
+1 |
Please add this and order by multiple fields! |
+1 |
+1 |
+1 💯 |
VERY needed |
is it yet not built???? how do I order my posts by number of upvotes??? |
Would be an amazing feature |
Any update on this? |
it's a really important feature. This issue was created two years ago and hasn't been fixed. |
Definitely agree, we are patiently waiting for this feature to push Prisma to production here :) |
Any update on this? |
Any update on this??? :( |
Can people please stop spamming this thread with "UPDATES????" and instead upvote the first comment? I does not help anything, they are currently working on Prisma 2 (where this feature will be integrated) and that will take a while. In the meantime, you're just notifiying 35 participants with no new information and thus wasting their time. I think they will update us once this feature is implemented. |
I upvoted the first comment months ago. |
Another workaround to avoid ordering client-side is to put an index attribute on the model related to another field
You have to handle
Yeah it's cumbersome, but works fine If you want ordering by multiple fields then do it client side, it's the only solution |
Or write a raw query, then use prisma.$fragment to get the type of data you need. |
@bkstorm could you provide us an example please? |
Is this feature will never be launched? |
it is a must to have feature, waiting almost 3 years? |
Prisma team, Are you working on this feature for Prisma V2? |
@bkstorm Do you have an example of this please? |
I don't use Prisma 1 any more due to it lacks a lot of features, like this one, but I will try to create an example code for you. |
Sorry, was just wondering if you ever got around an example for this? |
Example: a User has many Posts. Should be possible to order the Posts by User name.
Maybe:
The text was updated successfully, but these errors were encountered: