Would like to return an aggregate for the no. of u...
# orm-help
z
Would like to return an aggregate for the no. of users and the no. of clients
c
so it's a bit hard-to-find but to do aggregates (counts are the only supports aggs to the best of my knowledge), here's an example https://www.prisma.io/forum/t/access-connection-info-e-g-count-for-type-in-a-resolver/2522/4
it flows through the
connection
types for each entity, as opposed to the type for the entity itself
z
So how do I get this working?
s
Prisma uses the Relay edge spec for aggregation and pagination. More here: https://facebook.github.io/relay/graphql/connections.htm So if you want to count the number of users, for example, you could try querying the
UsersConnection
model instead of the
User
model. Should look something like this:
Copy code
{
  usersConnection{
    aggregate{
      count
    }
  }
}
z
Can I use the OrganizationConnection to get the Aggregate for Users and Clients?