Skip to content
VibORM
Esc
navigateopen⌘Jpreview
On this page

Number Filters

Filter operators for int, float, decimal, and bigInt scalars

Operators

Operator Description
equals Exact match
not Not equal
in Match any in array
notIn Match none in array
lt Less than
lte Less than or equal
gt Greater than
gte Greater than or equal

equals, not, in, and notIn work the same on every scalar type — see Filtering.

Comparisons

// Less than
where: { age: { lt: 18 } }

// Less than or equal
where: { age: { lte: 17 } }

// Greater than
where: { age: { gt: 65 } }

// Greater than or equal
where: { age: { gte: 21 } }

Range Queries

Combine operators for ranges:

// Between 18 and 65 (inclusive)
where: {
  age: {
    gte: 18,
    lte: 65,
  },
}

// Greater than 100 but not 200
where: {
  price: {
    gt: 100,
    not: 200,
  },
}

BigInt

BigInt uses the same operators with bigint values:

where: { viewCount: { gte: 1000000n } }
where: { id: { in: [1n, 2n, 3n] } }

Examples

Price Range

async function getProductsInRange(min: number, max: number) {
  return client.product.findMany({
    where: {
      price: {
        gte: min,
        lte: max,
      },
    },
    orderBy: { price: "asc" },
  });
}

Was this page helpful?