client.db. Collections must be created in the urBackend Dashboard before you can interact with them.
Methods that return documents accept a generic type parameter T (extending DocumentData) so returned documents are fully typed. Methods like delete() return status objects and do not accept T.
Row-Level Security (RLS)
If a collection has RLS enabled, you must provide the user’saccessToken to perform write operations (insert, update, patch, delete).
Example pattern:
getAll
Fetch documents from a collection with optional filtering, sorting, and pagination.params)
| Parameter | Type | Description |
|---|---|---|
filter | object | Filter by field suffixes (e.g. { age_gt: 18 }). |
sort | string | Sort order (e.g. "createdAt:desc"). |
limit | number | Max documents to return (max 100). |
page | number | Page number for pagination. |
populate | string | string[] | Expand Reference fields into full objects. |
getOne
Fetch a single document by its ID.insert
Insert a new document. If RLS is enabled, thetoken parameter is required.
update
Update an existing document by its ID. This performs a full replacement of the document fields.patch
Partially update a document. Only the fields provided indata will be modified.
