Skip to main content

Overview

Filters are the core of Criteria. They define conditions that records must match. Each filter consists of a field, an operator, and (usually) a value.

Filter Methods

Generic where()

The most flexible method - accepts any field, operator, and value:

Shorthand Methods

Convenience methods for common operations:

Operators by Type

String Operators

Number Operators

Date Operators

Boolean Operators

Array Operators

For array fields in your entity:

Nested Field Paths

Filter on nested object properties:

Array Item Field Paths

Filter on properties of items in arrays:
When filtering on array item properties, the filter matches if any item in the array matches the condition. For more control, see Quantifiers.

Combining Multiple Filters

All filters are combined with AND logic:

Filter Validation

The library validates filters at runtime:

Quantifiers

For array fields, you can specify how the filter should match:

whereSome - Any Item Matches

whereEvery - All Items Match

whereNone - No Item Matches

With Query Params

Quantifier support depends on your ORM/database. See the integration guides for specific implementations.

Real-World Examples

Product Catalog

Date Range Queries

Filter Interface

For reference, here’s the Filter type structure: