twenty icon indicating copy to clipboard operation
twenty copied to clipboard

🧮 Aggregate queries

Open FelixMalfait opened this issue 5 months ago • 6 comments

Our GraphQL API should support aggregate queries on findMany queries.

We already have totalCount so we can take inspiration from that. But it's significantly more challenging because the aggregated fields name are dynamic and depend on the object names themselves. Here's how it could look like:

query {
   companies {
    edges {
      node {
        id
        domainName {
          primaryLinkLabel
        }
        people {
          totalCount
          maxCreatedAt
        }
      }
    }
    totalCount
    maxCreatedAt
  }
}

We'll need to add: min, max, avg, sum, countDistinct

FelixMalfait avatar Sep 03 '24 06:09 FelixMalfait