Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Const

OR

OR combines alternative Prisma Client filter conditions. A record is selected when at least one condition in the array matches.

How it works

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.

Syntax

OR: [condition, ...]

Parameters

NameTypeDescription
ORPrisma filter condition[]Array of Prisma filter condition objects; at least one condition must evaluate to true.

Returns

A where filter condition that selects records matching one or more alternatives.

Key points

  • Prisma Client supports OR as one of the operators for composing filters.
  • The operator is placed inside the where object and receives an array of condition objects.
  • Each alternative can use a standard field filter, and the alternatives may be combined with NOT.

Example: Use OR in a filter

const users = await prisma.user.findMany({
  where: {
    OR: [
      { email: { endsWith: "gmail.com" } },
      { email: { endsWith: "company.com" } }
    ]
  }
});

Returns users whose email matches either suffix.

When to use it

Match any of several text patterns

Search

Accept records satisfying one of multiple criteria

Access rules

Combine alternatives with exclusions

Compound filtering

Interview questions

QWhat does Prisma's 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.

QHow is 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.

QWhere do you place 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.

  • AND
  • NOT
  • where
  • Filtering and sorting

Source: Filtering and sorting (Prisma ORM v7). Checked 2026-10-16.