hey all, i know this has probably been asked so ap...
# orm-help
v
hey all, i know this has probably been asked so apologies if so. How can i sort a query based on the number of items in an array the object has. I.e. if
User
object has
followers: [User!]!
property, how can I get a list of users sorted by number of followers?
a
I don't think that kind of nested sorting (sorting on subfields) is possible on the graphQL API that prisma provides. However maybe that's possible in the ORM that prisma released? I dunno
v
any links that i can read on the ORM?
a
I found something similar to your usecase, but just for relay: https://github.com/graphql/graphql-relay-js/issues/20 Does that help?
v
I was looking at the raw SQL query support in prisma 1.17 - that might work
a
Well that's always a useful crutch I guess
But what are you trying to actually solve?
v
I want to return a list of users based on the number of followers they have
it seems the current way to do that is to store the number of followers for each user and update it
a
Do you use eventsourcing?
v
i had to look up what that is, so my guess is no 😛
a
Ok, yeah then it's a bit harder