graphql
graphql copied to clipboard
Sort by aggregations
Describe the solution you'd like
For the following type definitions:
type Post {
content: String
likes: [User!]! @relationship(type: "LIKES", direction: IN)
}
type User {
name: String!
}
I would like to be able to query for posts with the highest count of likes
by doing something along the lines of:
query {
posts(options: { sort: { likesAggregate: { count: ASC } } }) {
content
}
}
I can't wait to have this feature!
We're keen to work on this, but we will first need to address https://github.com/neo4j/graphql/wiki/Apoc-runFirstColumn-usage#field-aggregations-count. Then we will likely look at sorting in a holistic manner, including sorting by fields on related nodes.
Any movement on this?
Thanks,
J