Skip to main content

CRUD Operations

Master the four fundamental database operations: Create, Read, Update, and Delete across all platforms.
CRUD operations are the building blocks of any application. Cocobase makes them simple, intuitive, and consistent across all languages.

Overview

Cocobase provides type-safe, efficient CRUD operations for all supported platforms:
  • Create - Add new documents to collections
  • Read - Retrieve documents by ID or with filters
  • Update - Modify existing documents (partial or full)
  • Delete - Remove documents from collections
  • Batch Operations - Perform multiple operations at once

Create Documents

Add new documents to your collections with automatic ID generation and timestamp tracking.

Basic Creation

Type-Safe Creation

Batch Creation

Create multiple documents in a single operation for better performance.

Read Documents

Retrieve documents by ID, or query collections with filters and pagination.

Get Single Document

List All Documents

With Filters

With Pagination


Update Documents

Modify existing documents with partial or full updates.

Basic Update

Updates are partial by default - you only need to provide the fields you want to change. Other fields remain unchanged.

Batch Update


Delete Documents

Remove documents from collections permanently.

Delete Single Document

Batch Delete

Instead of permanently deleting, mark documents as deleted for recovery options.

Error Handling

Handle errors gracefully across all operations.

Best Practices

Define your data structures for better development experience and fewer bugs.
Always wrap operations in try-catch blocks or check for errors.
Batch operations are more efficient than multiple individual requests.
Use soft deletes for important data to enable recovery.
Track when records are created and modified.

Next Steps

Query & Filtering

Learn advanced filtering and query techniques

Relationships

Work with related documents and references

Real-time Updates

Subscribe to live data changes

File Storage

Upload and manage files in documents