Need help with one thing. I need to have sorting o...
# prisma-whats-new
p
Need help with one thing. I need to have sorting on GUI layer and want to implement it in db layer (Relay). It's easy to sort by primitive fields such as
Customer.name
where
name
is a string. But how to implement
orderBy
on connection? Let's say
Customer
has connection to the
Address
type which has a
city: String
field. Now I want to sort Customers by city name. How to do that in GraphQL / GraphCool?
a
It's currently not possible yet to order by related fields: https://www.graph.cool/docs/reference/graphql-api/query-api-nia9nushae/#ordering-by-field
Relay also provides an advanced feature
@connection(key: 'FriendsList_friends', filters:['orderBy', ...])
that allows you to explicitly specify which variables should be used to generate the storage key.
This can't be used for sorting?
a
Sorry, I'm not sure. I only know that it can't be done server-side