Understanding Updates in Append-Only Storage
OnDB uses append-only storage. Updates do NOT modify existing data. Instead, a NEW record with the same ID and a newer timestamp is appended. Queries automatically return the latest version of each record. Use
queryBuilder().executeUnique() to get the latest version of a single record.Update Pattern
Update an existing document by finding it, modifying fields, and storing a new version.TypeScript
How Updates Work
Examples
Update Single Field
TypeScript
Conditional Update Pattern
TypeScript
Historical Data
Since updates append new records, you can query historical versions:TypeScript
Next Steps
Delete
Soft delete documents
Create
Create new documents