graphql icon indicating copy to clipboard operation
graphql copied to clipboard

Sort by aggregations

Open darrellwarde opened this issue 2 years ago • 3 comments

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
    }
}

darrellwarde avatar Mar 21 '22 08:03 darrellwarde

I can't wait to have this feature!

Dajust avatar Mar 21 '22 12:03 Dajust

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.

darrellwarde avatar Sep 23 '22 09:09 darrellwarde

Any movement on this?

Thanks,

J

jdgamble555 avatar Mar 24 '23 08:03 jdgamble555