Skip to content

Types Reference

Filter

Filters are used to narrow down the results based on specific criteria.

PropTypeDefault
fieldstringThe field to filter by (e.g., "age", "name").
operatorstringThe comparison operator to apply (e.g., "==", ">=", "<").
valuestring | numberThe value to compare the field against.

Example

js
const filters = [
  { field: "age", operator: ">=", value: 18 },
  { field: "name", operator: "==", value: "John Doe" }
];

const users = await db.getAll("users", { filters });

console.log(users); // Logs up to 10 users aged 18 or older with the name "John Doe"

Released under the SSPL License.