Long Text Records
Large text storage with Operational Transformation
Overview
Long Text Records are designed for storing and collaboratively editing large text content. They use Operational Transformation (OT) for real-time collaboration, allowing multiple users to edit the same document simultaneously.
When to Use Long Text
Use Long Text Records when you need:
- Large text documents (notes, articles, code)
- Real-time collaborative text editing
- Character-by-character synchronization
Use Key-Value Records instead when:
- You have structured data (JSON objects)
- Text is relatively short and rarely edited collaboratively
- You need to update specific fields independently
Creating Long Text Records
Using createLongText()
Using create()
In Blueprint Pattern
Reading Content
Updating Content
Replace Entire Content
Using set() replaces the entire text content. For collaborative editing,
use the real-time editing approach with load().
Real-Time Collaboration
Enabling Real-Time Updates
Editing with OT
Once loaded, edits are automatically synchronized:
Querying Long Text Records
By Type
By Relationship
Integration with Text Editors
Long Text Records work well with text editor libraries. Here's a conceptual example:
Common Patterns
Meeting Notes
Documentation
Code Snippets
Permissions
Long Text Records follow the same authorization model as other records:
Limitations
-
No partial updates - Unlike Key-Value Records, you can't update specific portions through the API (OT handles this internally during real-time)
-
Text only - No binary content, use Blob Records for files
Best Practices
-
Use for prose content - Long Text is ideal for documents, notes, and articles
-
Clean up subscriptions - Always call
unload()when done to free resources -
Combine with Key-Value - Use Key-Value Records for metadata (title, author, tags) and Long Text Records for the content body