Long Text Attributes
Large text storage with Operational Transformation
Overview
Long Text Attributes 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 Attributes when you need:
- Large text documents (notes, articles, code)
- Real-time collaborative text editing
- Character-by-character synchronization
Use Key-Value Attributes 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 Attributes
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 Attributes
By Type
By Relationship
Integration with Text Editors
Long Text Attributes work well with text editor libraries. Here's a conceptual example:
Common Patterns
Meeting Notes
Documentation
Code Snippets
Permissions
Long Text Attributes follow the same authorization model as other attributes:
Limitations
-
No partial updates - Unlike Key-Value Attributes, you can't update specific portions through the API (OT handles this internally during real-time)
-
Text only - No binary content, use Blob Attributes 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 for metadata (title, author, tags) and Long Text for the content body