Skip to content
VibORM
Esc
navigateopen⌘Jpreview
On this page

Number Filters

Filter operators for integer, approximate-number, fixed-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.

Decimal operands accept Decimal, string, or number inputs and validate them against the field’s { precision, scale } descriptor. Comparisons and ordering stay exact on SQLite because the stored value is a scaled integer coefficient; no decimal path casts through REAL.

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?