For this data model can I query how many users are...
# orm-help
j
For this data model can I query how many users are in each group?
Copy code
type User {
  id: ID! @unique
  groups: [Group!]!
}

type Group {
  id: ID! @unique
  name: String!
  users: [User!]!
}
I can return the user object but all I actually need is the count. You could do this with Graphcool BaaS
Copy code
groups {
    name
    category {
      name
    }
    users {
      id
    }
  }
}
w
I believe you will have to change your groups query to return a count and then implement the count on the backend. See example under 'Returning the total amount of Link elements' https://www.howtographql.com/graphql-js/8-filtering-pagination-and-sorting/
j
Connection queries provide a count but I it doesn’t look like normal queries do, so I think you’re right. Thanks https://www.prisma.io/docs/reference/prisma-api/queries-ahwee4zaey#connection-queries