Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support common aggregate queries #91

Open
billy1624 opened this issue Nov 4, 2022 · 0 comments
Open

Support common aggregate queries #91

billy1624 opened this issue Nov 4, 2022 · 0 comments
Milestone

Comments

@billy1624
Copy link
Member

Motivation

Be able to querying of common aggregation on a column.

Proposed Solutions

  • Aggregate at root
query {
  postAggregate(filter: {  # Generate a query with name `<Entity>Aggregate` for each entity
    title: {
        anyofterms: "GraphQL"
      }
  }) {
    count  # COUNT(*)
    numLikesMax  # MAX(num_likes)
    numLikesMin  # MIN(num_likes)
    numLikesSum  # SUM(num_likes)
    numLikesAvg  # AVG(num_likes)
  }
}
  • Aggregate at child
query {
  author {
    name
    postAggregate(filter: {  # Generate a query with name `<Entity>Aggregate` for each related entity
      title: {
          anyofterms: "GraphQL"
        }
    }) {
      count  # COUNT(*)
      numLikesMax  # MAX(num_likes)
      numLikesMin  # MIN(num_likes)
      numLikesSum  # SUM(num_likes)
      numLikesAvg  # AVG(num_likes)
    }
  }
}

Additional Information

Similar API is provided on Dgraph:

@karatakis karatakis added this to the 1.1.0 milestone Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

2 participants