Overview
There are 7 methods you can use to interact with the database. They are used in conjunction with thedb property from the useBasic() hook, and are appended in the format of db.collection('tablename').METHOD().
Methods
.get()
Fetch a single item from the table by its ID. Returns
null if not found..getAll()
Fetch all items from the table. Returns an empty array if no items exist.
In the React / Next.js client SDK (sync or remote mode),
.getAll() loads items for that collection and .filter() applies your predicate on the client after fetch. For server-side query parameters on HTTP, use the REST API filtering guide against the PDS endpoints instead..add()
Adds a new item to the table. The
id is automatically generated by the server. Returns the created object with its new ID..put()
Upsert (insert or replace) an item. The
data object must include an id field. If an item with that ID exists, it will be replaced entirely. If not, a new item will be created. Returns the upserted object..update()
Partially update an existing item by ID. Only the fields you provide will be updated—other fields remain unchanged. Returns the updated object, or
null if the item was not found..delete()
Deletes an item from the table by ID. Returns
true if deleted, false if the item was not found..filter()
Filter records using a predicate function. This fetches all records and filters client-side. Returns an array of matching objects.
Examples
Read items
There are 2 ways to read items from the database:.get('ID_OF_ITEM'): Fetches a single item by ID.getAll(): Fetches all items from the table
App.tsx
Add new item
App.tsx
Put (upsert) item
App.tsx
Update item
App.tsx
Delete item
App.tsx
Filter items
App.tsx
TypeScript Support
Thecollection method supports generics for type-safe database operations:
App.tsx

