Filter Entities
Query Entities
{
"where": {
"age": 30
}
}Use the where clause in your request body to retrieve a specific subset of entities. The filtering syntax follows the Drizzle Relation Query (RQB) pattern, allowing you to use logical operators and comparison methods to build complex queries.
| Category | Operator | Description |
|---|---|---|
| Logical | AND, OR, NOT | Combine multiple filter conditions. |
| Comparison | eq, ne, gt, gte, lt, lte | Equality and comparison operators. |
| Inclusion | in, notIn | Check if a value exists within an array. |
| String | like, ilike, notLike, notIlike | Case-sensitive and case-insensitive pattern matching. |
| Nullity | isNull, isNotNull | Check if a column is null or contains a value. |
| Array | arrayOverlaps, arrayContained, arrayContains | Specialized filters for array column types. |
[Full Syntax Schema]
Use this schema to construct nested queries. Refer to the API reference and Entities for specific field names and valid values.
{
"where": {
"relation_name": {},
"column_name": {
"OR": [],
"AND": [],
"NOT": {},
"eq": 1,
"ne": 1,
"gt": 1,
"gte": 1,
"lt": 1,
"lte": 1,
"in": [1],
"notIn": [1],
"like": "",
"ilike": "",
"notLike": "",
"notIlike": "",
"isNull": true,
"isNotNull": true,
"arrayOverlaps": [1, 2],
"arrayContained": [1, 2],
"arrayContains": [1, 2]
}
}
}Paginate Results
Control the size of your result set using these parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 0 | The zero-based index of the current page. |
page_size | integer | 25 | The maximum number of items returned per page. |
The server returns your requested data alongside pagination metadata:
{
items: Array<T>, // The list of records matching the query
page: number, // The zero-based index of the current page
page_size: number, // Items per page
total: number, // Total records in the database (ignoring filters)
total_filtered: number, // Total records matching your filter criteria
}Subscribe to Live Updates
Subscribe via Socket.io to receive real-time updates for an entity.
When you subscribe, the server sends an initial list of entities matching your criteria. If a record is added, modified, or removed in a way that affects your filters, the server automatically pushes the updated list via the baseline.filter.list event.
WARNING
Pagination settings (page and page_size) still apply to live filtered streams.
Use the Baseline Client
The baseline-client library simplifies implementation by handling request construction for you.
Fetch a Static List
const todos = await baseline.api.list("todos");Listen to a Live Filtered List
const todos = baseline.api.liveList("todos", {
where: {
title: {
like: "example%"
}
},
page_size: 10
});