Overview
Records are the actual data stored in your collections. Each record in a collection has the same structure (schema) defined by the collection’s fields.List Records
Get all records from a collection with pagination:With Filtering
With Sorting
With Pagination
With Field Selection
Combined Example
Get a Single Record
Retrieve a specific record by ID:With Field Selection
With Related Records
Create a Record
Create a new record in a collection:The
id, createdAt, and updatedAt fields are automatically generated
by SnackBase.Update a Record
Full Update (PUT)
Replace all fields of a record:Partial Update (PATCH)
Update only specific fields:Delete a Record
Remove a record from a collection:Using the Query Builder
For complex queries, use the fluent query builder:TypeScript Support
Use TypeScript for type-safe record operations:Batch Operations
Create Multiple Records
Update Multiple Records
Real-Time Updates
Combine with the real-time service for live updates:Error Handling
Reference
list(collection, params?)
List records from a collection.
Parameters:
collection(string) - Collection nameparams(object) - Query parametersfilter(object) - Filter expressionsort(string) - Sort expressionskip(number) - Records to skiplimit(number) - Max records to returnfields(string[]) - Fields to returnexpand(string[]) - Relations to expand
Promise<RecordListResponse>
get(collection, recordId, params?)
Get a single record by ID.
Parameters:
collection(string) - Collection namerecordId(string) - Record IDparams(object) - Query parametersfields(string[]) - Fields to returnexpand(string[]) - Relations to expand
Promise<any & BaseRecord>
create(collection, data)
Create a new record.
Parameters:
collection(string) - Collection namedata(object) - Record data
Promise<any & BaseRecord>
update(collection, recordId, data)
Full update of a record (PUT).
Parameters:
collection(string) - Collection namerecordId(string) - Record IDdata(object) - Complete record data
Promise<any & BaseRecord>
patch(collection, recordId, data)
Partial update of a record (PATCH).
Parameters:
collection(string) - Collection namerecordId(string) - Record IDdata(object) - Fields to update
Promise<any & BaseRecord>
delete(collection, recordId)
Delete a record.
Parameters:
collection(string) - Collection namerecordId(string) - Record ID
Promise<{ success: boolean }>
query(collection)
Create a query builder for the collection.
Parameters:
collection(string) - Collection name
QueryBuilder
Batch Operations
Perform multiple record operations atomically using the dedicated batch endpoint:Aggregation Queries
Run server-side aggregations without fetching raw records:count, sum, avg, min, max.
Reference Expansion
Expand reference fields inline to avoid N+1 queries:Next Steps
- Query Builder - Advanced querying
- Collections - Manage collections
- Realtime - Real-time subscriptions