Filtering Query Results

1. Using Equals Filter

FormExample
Shorthand{ status: "active" }
Explicit{ status: { equals: "active" } }

2. Using NOT Filter

await prisma.user.findMany({ where: { NOT: { role: "ADMIN" } } });
FormUse
{ field: { not: x } }Single negation
{ NOT: {...} }Negate compound clause

3. Using IN Operator

await prisma.user.findMany({ where: { role: { in: ["ADMIN","EDITOR"] } } });
OperatorSQL
inIN (...)

4. Using NOT IN Operator

FormDetail
{ field: { notIn: [...] } }NOT IN (...)

5. Comparing Values

OperatorSQL
gt>
gte>=
lt<
lte<=

6. Filtering String Contains

await prisma.user.findMany({
  where: { email: { contains: "@example.com", mode: "insensitive" } }
});
OperatorBehavior
containsSubstring match (LIKE %x%)
startsWithPrefix
endsWithSuffix

7. Using String Filters

FilterUse
equalsExact
searchFull-text search (PG/MySQL)
mode"default" | "insensitive"

8. Using Case-Insensitive Filtering

await prisma.user.findMany({
  where: { name: { equals: "alice", mode: "insensitive" } }
});
DBSupport
PGILIKE
MySQLCollation-driven (utf8mb4_ci)
SQLiteLimited

9. Combining Filters

await prisma.post.findMany({
  where: {
    AND: [
      { published: true },
      { OR: [{ tags: { some: { name: "react" } } }, { title: { contains: "TS" } }] }
    ]
  }
});
OperatorUse
ANDAll conditions
ORAny condition
NOTNegate clause

10. Using Nested Relation Filters

FilterUse
is / isNotTo-one relation
some / every / noneTo-many relation
Deep nestingSupported for any depth