Match any of several text patterns
Search
Prisma · Const
OR combines alternative Prisma Client filter conditions. A record is selected when at least one condition in the array matches.
OR is a Prisma Client relation filter that accepts an array of conditions. A record matches when at least one condition evaluates to true, allowing alternative criteria in a where clause.
OR: [condition, ...]| Name | Type | Description |
|---|---|---|
OR | Prisma filter condition[] | Array of Prisma filter condition objects; at least one condition must evaluate to true. |
A where filter condition that selects records matching one or more alternatives.
OR as one of the operators for composing filters.where object and receives an array of condition objects.NOT.const users = await prisma.user.findMany({
where: {
OR: [
{ email: { endsWith: "gmail.com" } },
{ email: { endsWith: "company.com" } }
]
}
});Returns users whose email matches either suffix.
Search
Access rules
Compound filtering
OR filter do?OR combines multiple filter objects in a where clause. Prisma includes a record when one or more of those conditions evaluates to true.
Follow-up: How would you require every condition instead? Use AND, which combines conditions so they all must match.
OR structured in a Prisma query?Pass OR an array containing the alternative conditions. Each array element is a normal Prisma filter object, such as an email suffix condition.
Follow-up: Can alternatives target different fields? Yes, each object can use a different field or supported filter operation.
OR in Prisma Client?OR belongs inside the query's where object and can be combined with other operators. For example, NOT can exclude records after the alternatives are evaluated.
Follow-up: What is the purpose of NOT in such a query? It removes records matching the negated condition.
ANDNOTwhereFiltering and sorting