Skip to content

Aggregates only work with groupBy #172

Description

@kevin-dp

Currently, aggregates only work with groupBy which means we can't write collection-wide aggregates like in this snippet:

const aggregateQuery = queryBuilder()
  .from({ collection })
  .select({
    rows: { COUNT: `@id` },
    avg_age: { AVG: `@age` },
  })

A possible implementation strategy would be to have select check if there is a groupBy clause and if not add a default groupBy that groups by null to have a collection-wide groupBy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions