-
Notifications
You must be signed in to change notification settings - Fork 867
Order by multiple fields #62
Comments
very important.. would love to see this feature out of the backlog :) |
Yes! :) |
Yes please! |
Would be half a feature if it was limited to top level fields. I think the orderBy parameter Type should mirror the query Type, so all fields down the hierarchy are available for orderBy. |
@kbrandwijk half a feature is better than not having it at all. Would love to see this live, we currently have a use case for ordering by a category first, then a date field. |
Any news on this? |
Hi .. I also have an idea (just as an idea to be improved if considered..): query{ films{ title[='st%'*='at%'] +year[=1998*=2011..2013*>2016] +auth +cinemas|skip,take|{ city|asc|[='bu%'] +d=dist(#c,l)|desc|[<=700]} } } Where operator: * is 'or' + is 'and' .. is 'between' ... is 'open right range [..)' .... is 'open right range (..]' field[op value ...] is where field op value i.e. age[>22] d is 'computed field' #c is a parameter field|skip,take| is paging on collection field|desc| is order desc [=val,...] equal sign can be implicit and omitted |
Can anyone give a status update on this please? |
I built a filter abstraction for graphql-dotnet, which is similar to prisma. query{
servers(
orderBy: {
active: DESC
assetNumber: ASC
}
) {
id
active
assetNumber
}
} You can even specify the order of orderBy statements. The example above is first ordered by active and then by assetNumber. The following would be first ordered by assetNumber and then by active ...
orderBy: {
assetNumber: ASC
active: DESC
}
... That would also be a solution for #95 query{
servers(
orderBy: {
active: DESC
assetNumber: ASC
customer: {
name:ASC
}
}
) {
id
active
assetNumber
customer {
name
}
}
} That probably would end up in breaking changes though. |
How do you specify the order (sequence) of the order clauses? Does graphql.net preserve the order of input fields? But even if it does, the client may have problems preserving the order of properties in a variable value. Otherwise, I'd go with an array of enums (the enums being prisma's current enum) - that's how we do it in cruddl. |
@Yogu |
It does preserve the order. The problem was that I didn't handle OrderBy and ThenBy properly. Json serializers should preserve the order. var serializationObjectBefore = {
orderBy: {
customer: "Test",
active: "Test"
}
}
var first = JSON.stringify(serializationObjectBefore)
var serializationObjectAfter = JSON.parse(first)
var second = JSON.stringify(serializationObjectAfter)
var serializationObjectBefore = JSON.parse(first)
second
"{"orderBy":{"customer":"Test","active":"Test"}}"
first
"{"orderBy":{"customer":"Test","active":"Test"}}" But still. orderBy: {
assetNumber: {
position: 1,
direction: DESC
}
} |
|
@sorenbs thanks for the clarification I already had the feeling that there is nothing happen any longer in the graph.cool world. Sad for me I thought that it was an amazing idea and I have many production apps online. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
any update on this, nya? |
any plans on implementing this feature? it seems like a very important one to have... |
Would love to see this added 🙏 |
Yes me too, would love to have this feature built-in |
I need this feature! |
+1 |
this issue was removed from ROADMAP.md 5 days ago :( |
Would love to see orderBy by multiple fields and inner relations ordering Any updates? |
+1 |
This is a must have feature. I hope Prisma 2 can bring it to life 🙏 |
@sorenbs none of you large customers had to implement something like this? It seems to be a pretty common use case |
This is a much needed feature, even for hobby project! |
I switched to AWS AppSync |
Hi, |
@charleslouis This will not be coming. Prisma 1 is dead. |
@phryneas alright. Thanks for letting me know. |
+1 |
1 similar comment
+1 |
The text was updated successfully, but these errors were encountered: