Data Model
Tarobase organizes data in a hierarchical structure using collections and documents. Collections are containers that hold documents, and documents can contain both data and subcollections. This creates a flexible tree-like structure where data can be nested as deeply as needed.
For example, you might have a collection called "users" that contains user documents, and each user document could have a subcollection called "posts" containing that user's posts. The path to a specific post would look like "users/$userId/posts/$postId".
Collections
Collections are the top-level containers in Tarobase. They help organize related documents together and support operations like:
- Querying documents based on field values
- Ordering results by specific fields
- Limiting the number of results
- Real-time updates when documents change
- Pagination through large sets of documents
Documents
Documents are the individual units of data within collections. Each document:
- Has a unique ID within its collection
- Contains key-value pairs of data
- Can hold different data types (strings, numbers, booleans, arrays, objects)
- Can contain subcollections
- Can be individually retrieved, updated, or deleted
- Supports atomic operations for data consistency
For example, a user document might look like:
users/abc123
and have fields like the following:
- name: "John Doe"
- email: "john@example.com"
- age: 30
This structure allows you to model complex relationships and hierarchies while keeping your data organized and easily accessible.