neo4j / graphql

A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.
https://neo4j.com/docs/graphql-manual/current/
Apache License 2.0
508 stars 149 forks source link

Sort by aggregations #1156

Open darrellwarde opened 2 years ago

darrellwarde commented 2 years ago

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
    }
}
Dajust commented 2 years ago

I can't wait to have this feature!

darrellwarde commented 2 years ago

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.

jdgamble555 commented 1 year ago

Any movement on this?

Thanks,

J