Prisma where-clause operators
Prisma Client filters records with a where object whose keys are field names
and whose values are operator objects. The operators cover equality,
comparison, string matching, list membership, logical combination and relation
filtering. This reference groups every operator, notes which field types it
applies to, and gives a usable example so you can compose precise queries.
How it works
Each field maps to an operator object; multiple keys are implicitly AND-ed:
const rows = await prisma.user.findMany({
where: {
age: { gte: 18, lt: 65 },
name: { contains: "ann", mode: "insensitive" },
role: { in: ["ADMIN", "EDITOR"] },
OR: [{ verified: true }, { invitedById: { not: null } }],
},
});
Comparison operators (gt, gte, lt, lte) need orderable types; string
operators (contains, startsWith, endsWith) accept mode: 'insensitive' on
PostgreSQL and MongoDB; in/notIn test list membership; AND/OR/NOT
group conditions.
Tips and notes
- Top-level keys are AND-ed automatically; only use
ANDto groupORblocks. mode: 'insensitive'is required for case-insensitive matching, not the default.- Use
infor value-set membership andcontainsfor substring search. - Relation filters
some/every/nonequery one-to-many;is/isNotquery to-one.