Skip to main content

Understanding Deletes in Append-Only Storage

OnDB performs soft deletes. When you delete a document, a new record with deleted: true is appended. The original data is preserved but excluded from query results by default.

Delete Pattern

Soft delete a document by finding it and storing a new version with deleted: true.
TypeScript

How Deletes Work

Examples

Delete by ID

TypeScript

Conditional Delete Pattern

TypeScript

Verifying Deletion

After deletion, the document won’t appear in normal queries:
TypeScript

Data Retention

Since OnDB uses append-only storage:

Bulk Delete Pattern

For deleting multiple documents, query and delete each:
TypeScript

Next Steps

CRUD Overview

Back to CRUD overview

Query Builder

Complex queries