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

Prisma · Const

lte

lte filters Prisma Client query results to records whose field value is less than or equal to a specified value.

How it works

Use the lte filter in a Prisma Client where condition to select records whose field value is less than or equal to a supplied value. The comparison value can also come from another field through the model's fields property.

Syntax

{ field: { lte: value } }

Parameters

NameTypeDescription
nscalar value or model field referenceThe value or same-table field reference that the selected field must be less than or equal to.

Returns

Records whose selected field value is less than or equal to the comparison value.

Key points

  • lte matches values that are less than or equal to the supplied comparison value.
  • The filter is used inside a Prisma Client query such as findMany.
  • A field-to-field comparison can test one model field against another.

Common mistakes

  • For a same-table column comparison, reference the other column through the model's fields property rather than supplying a literal value.

Example: Filter with lte

const posts = await prisma.post.findMany({
  where: {
    likes: { lte: 9 },
  },
});

Returns posts whose likes value is at most 9.

When to use it

Upper-bound filtering

Retrieve records up to a numeric threshold.

Same-table field comparison

Compare two columns from the same model.

Interview questions

QWhat does Prisma's lte filter do?

lte means less than or equal to. In a where clause, it returns records whose selected field value does not exceed the comparison value.

Follow-up: How would you compare two columns in one table? Use the model's fields property as the comparison value, such as quantity: { lte: prisma.product.fields.warnQuantity }.

QHow is lte written in a Prisma Client query?

Place lte inside the field's filter object in a Prisma Client query. For example, likes: { lte: 9 } selects records with nine or fewer likes.

Follow-up: What query operation commonly uses this filter? It can be used in a findMany query's where clause to restrict returned records.

QCan lte compare one column with another?

The right-hand side can be a field reference when comparing columns in the same table. Prisma documents this with quantity: { lte: prisma.product.fields.warnQuantity }.

Follow-up: What does that expression express? It selects products whose quantity is less than or equal to their warning quantity.

  • lt
  • gt
  • gte
  • equals
  • where
  • findMany

Source: Prisma Client API. Checked 2026-10-16.