Skip to main content
Access database methods via 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, token requirements depend on mode:
  • public-read: token is required for writes (insert, update, patch, delete), optional for reads.
  • private: token is required for both reads and writes when using a publishable key (pk_live_...).
Example pattern:

getAll

Fetch documents from a collection with optional filtering, sorting, and pagination.
Query Parameters (params) Example

getOne

Fetch a single document by its ID.
Example

count

Count documents in a collection.
Use token for private-mode reads when using publishable keys.

insert

Insert a new document. If RLS is enabled, the token 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 in data will be modified.
Example

delete

Delete a document by its ID.

TypeScript Support

Define your interfaces to get full IDE autocomplete: