Records are instances of collection data. They represent individual rows in your database tables and provide methods for data manipulation.
Creating records
NewRecord()
Create a new empty record for a collection:
Setting field values
Bulk loading data
Saving records
Finding records
FindRecordById()
Find a record by its ID:
FindFirstRecordByData()
Find the first record matching a key-value pair:
FindFirstRecordByFilter()
Find the first record matching a filter:
FindRecordsByFilter()
Find multiple records with filtering, sorting, and pagination:
FindRecordsByIds()
Find multiple records by their IDs:
FindAllRecords()
Find all records matching optional expressions:
Getting field values
Type-safe getters
Generic Get()
Get a value as any type:
GetRaw()
Get the raw, unnormalized value:
Updating records
Update and save
Field modifiers
Use modifiers to perform operations on numeric and array fields:
ReplaceModifiers()
Manually apply modifiers to data:
Deleting records
Delete a record
Truncate a collection
Delete all records in a collection:
Truncating a collection deletes all records and triggers cascade actions. This operation cannot be undone.
Working with files
Getting uploaded files
Access files that are being uploaded with the record:
Finding files
Record expansion
ExpandedOne()
Get a single related record from expanded data:
ExpandedAll()
Get multiple related records from expanded data:
Expanding records programmatically
Record cloning
Clone()
Create a shallow copy with all data, expand, and flags:
Fresh()
Create a copy with only the latest collection fields data:
Original()
Get a copy with the original database state:
Record visibility
Hide fields
Hide fields from public serialization:
Unhide fields
Force unhide specific fields:
WithCustomData()
Allow exporting custom (non-schema) fields:
IgnoreEmailVisibility()
Ignore the email visibility check for auth records:
Advanced options
IgnoreUnchangedFields()
Only save fields that have changed:
Save without validation
Saving without validation bypasses all field validation rules. Use with caution.
Auth records
Finding auth records
Auth record helpers
Creating auth tokens
Query builder
RecordQuery()
Create a custom query for advanced filtering:
JSON operations
UnmarshalJSONField()
Unmarshal a JSON field into a struct:
PublicExport()
Export only safe fields for public use:
Type signature