Prisma ORM · Prisma Client queries
Count and aggregate
Count rows and compute statistics.
const total = await prisma.user.count({ where: { role: "USER" } });
const stats = await prisma.post.aggregate({ _count: true, _max: { createdAt: true } });
Official Prisma ORM documentation