| name | prisma-client-api-filters |
| description | Filter Conditions and Operators |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
Filter Conditions and Operators
Filter operators for the where clause.
Equality
where: { email: 'alice@prisma.io' }
where: { email: { equals: 'alice@prisma.io' } }
where: { email: { not: 'alice@prisma.io' } }
Comparison
where: { age: { gt: 18 } }
where: { age: { gte: 18 } }
where: { age: { lt: 65 } }
where: { age: { lte: 65 } }
where: { age: { gte: 18, lte: 65 } }
Lists
where: { role: { in: ['ADMIN', 'MODERATOR'] } }
where: { role: { notIn: ['GUEST', 'BANNED'] } }
String Filters
where: { email: { contains: 'prisma' } }
where: { email: { startsWith: 'alice' } }
where: { email: { endsWith: '@prisma.io' } }
where: {
email: {
contains: 'PRISMA',
mode: 'insensitive'
}
}
Null Checks
where: { deletedAt: null }
where: { deletedAt: { not: null } }
where: { middleName: { isSet: true } }
Logical Operators
AND (implicit)
where: {
email: { contains: '@prisma.io' },
role: 'ADMIN'
}
AND (explicit)
where: {
AND: [
{ email: { contains: '@prisma.io' } },
{ role: 'ADMIN' }
]
}
OR
where: {
OR: [
{ email: { contains: '@gmail.com' } },
{ email: { contains: '@prisma.io' } }
]
}
NOT
where: {
NOT: {
role: 'GUEST'
}
}
where: {
NOT: [
{ role: 'GUEST' },
{ verified: false }
]
}
Combined
where: {
AND: [
{ verified: true },
{
OR: [
{ role: 'ADMIN' },
{ role: 'MODERATOR' }
]
}
],
NOT: { deletedAt: { not: null } }
}
Relation Filters
some
At least one related record matches:
where: {
posts: {
some: { published: true }
}
}
every
All related records match:
where: {
posts: {
every: { published: true }
}
}
none
No related records match:
where: {
posts: {
none: { published: true }
}
}
is / isNot (1-to-1)
where: {
profile: {
is: { country: 'USA' }
}
}
where: {
profile: {
isNot: null
}
}
Array Field Filters
For fields like String[]:
where: { tags: { has: 'typescript' } }
where: { tags: { hasSome: ['typescript', 'javascript'] } }
where: { tags: { hasEvery: ['typescript', 'prisma'] } }
where: { tags: { isEmpty: true } }
JSON Filters
where: {
metadata: {
path: ['settings', 'theme'],
equals: 'dark'
}
}
where: {
metadata: {
path: ['bio'],
string_contains: 'developer'
}
}
Full-Text Search
where: {
content: {
search: 'prisma database'
}
}