Prisma Query Operators Reference

All Prisma where clause operators — equals, contains, startsWith, in, gt, lte.

Reference for Prisma Client where-filter operators: equality, comparison (gt, gte, lt, lte), string matching (contains, startsWith, endsWith, mode), list (in, notIn) and logical (AND, OR, NOT) with type applicability.

What operators does Prisma use for comparison?

Prisma uses equals, not, gt (greater than), gte (greater or equal), lt (less than) and lte (less or equal). They apply to numbers, DateTime and other orderable scalars, and equals or not work on every type.

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 AND to group OR blocks.
  • mode: 'insensitive' is required for case-insensitive matching, not the default.
  • Use in for value-set membership and contains for substring search.
  • Relation filters some/every/none query one-to-many; is/isNot query to-one.