is it possible to get aggregate counts on a subfie...
# orm-help
d
is it possible to get aggregate counts on a subfield of many nodes? for instance...
Copy code
type Company implements Node {
  id: ID!
  date_founded: Int
  description: String
  image: CompanyImage
  country: Country
  name: String!
  slug: String!
  website: String
  jobs(
    where: JobWhereInput
    orderBy: JobOrderByInput
    skip: Int
    after: String
    before: String
    first: Int
    last: Int
  ): [Job!]
}
can I query all companies and get the number of jobs associated with each company? Something kind of like the following...
Copy code
# Write your query or mutation here
query {
  companies {
    name
    jobsConnection {
      aggregate {
        count
      }
    }
  }
}
b
it's impossible. hasura.io have this feature, it would be nice if prisma will implement this feature in the future.
I think you have to create a custom field for Company Type