How get count items in model?


#1

Hi, I’m doing a server like this example
I have a scheme

type Game {
  id: ID!
  name: String!
  excerpt: String
}

type Query {
    games: [Game!]!
}

and I need to get the number of entries Game.
How to do it using typescript and generated client ?


#2

Hi @Garik

You can use aggregation for this. ’

Refer: https://www.prisma.io/docs/prisma-client/basic-data-access/reading-data-TYPESCRIPT-rsc3/#aggregations


#3

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.