FilterInput class
A where clause as plain, serializable JSON.
Signature:
export declare class FilterInput
Remarks
Gives a remote caller the same expressive power Sequelize offers locally — comparison, set membership, pattern matching, regular expressions and range operators, nested arbitrarily through $and and $or. Every operator is a $-prefixed string rather than a symbol, because symbols do not survive the wire; FILTER_OPS does the translation on arrival.
Two things follow from how query.toWhereOptions walks it. Keys are read recursively, so a value that is itself an object is treated as a nested filter and only a non-object value ends the walk. And any key that is NOT a known operator is kept verbatim as a column name — which is what lets you mix columns and operators in one object, and also means a typo becomes a column rather than a complaint.
The declared property types are the common cases rather than hard limits; the runtime walk does not enforce them.
Example
// type is 'fast' or 'std', and the reservation was created this year
const filter = {
$or: [{ type: 'fast' }, { type: 'std' }],
createdAt: { $gte: '2026-01-01' },
} as FilterInput;
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
[number, number] |
(Optional) Ranges touch without overlapping (Postgres | ||
|
FilterInput | Array<FilterInput | number | string | boolean | null> |
(Optional) Every nested condition must hold (SQL | ||
|
number[] | string[] |
(Optional) Equals any element of the array (Postgres | ||
|
Array<number | string> |
(Optional) Within the inclusive | ||
|
[number, number] |
(Optional) The column's range is contained by this one (Postgres | ||
|
number | [number, number] |
(Optional) The column's range contains this value or range (Postgres | ||
|
number | string | boolean | null |
(Optional) Equal to. With | ||
|
number |
(Optional) Greater than. | ||
|
number |
(Optional) Greater than or equal to. | ||
|
string |
(Optional) Case-insensitive pattern match (Postgres | ||
|
Array<number | string | boolean | null> |
(Optional) One of the listed values (SQL | ||
|
string |
(Optional) Matches a regular expression, case-insensitively (Postgres | ||
|
string |
(Optional) Case-sensitive pattern match, | ||
|
number |
(Optional) Less than. | ||
|
number |
(Optional) Less than or equal to. | ||
|
number | string |
(Optional) Not equal to. | ||
|
[number, number] |
(Optional) Range does not extend past this one's left bound (Postgres | ||
|
[number, number] |
(Optional) Range does not extend past this one's right bound (Postgres | ||
|
boolean |
(Optional) Negates the nested condition (SQL | ||
|
Array<number | string> |
(Optional) Outside the inclusive | ||
|
string |
(Optional) Fails a case-insensitive pattern match. | ||
|
Array<number | string | boolean | null> |
(Optional) None of the listed values (SQL | ||
|
string |
(Optional) Fails a case-insensitive regular expression (Postgres | ||
|
string |
(Optional) Fails a case-sensitive pattern match. | ||
|
string |
(Optional) Fails a POSIX regular expression (Postgres | ||
|
FilterInput | Array<FilterInput | number | string | boolean | null> |
(Optional) At least one nested condition must hold (SQL | ||
|
[number, number] |
(Optional) Ranges share at least one value (Postgres | ||
|
string |
(Optional) Matches a POSIX regular expression (Postgres | ||
|
[number, number] |
(Optional) Range lies entirely to the left of this one (Postgres | ||
|
[number, number] |
(Optional) Range lies entirely to the right of this one (Postgres |