Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ditto.live/llms.txt

Use this file to discover all available pages before exploring further.

Databases

In Ditto, a database is a grouping of collections. All databases that embed the Ditto SDK and share the same database ID will automatically form a mesh network and synchronize data with each other, either directly or via Ditto Server.

Collections

Ditto stores documents in collections. Collections are analogous to tables in relational databases. Collections allow you to group similar documents together within the same namespace.

Structuring Collections

While it is good practice for documents within a collection to share a similar structure — for instance, all car-related documents stored in the cars collection contain fields 'make', 'model', and 'year' — structural uniformity is not mandatory. There is no limit to the number of collections you can have in your data model, so create as many collections as you need.

Managing Collections

Every document must be associated with a collection, even if only one document exists within that collection. There are no explicit steps to manage collections; Ditto implicitly creates collections when you first store data for that collection.

Querying Collections

When querying, database interactions occur with collections rather than individual documents. For instance, the query below searches the entire cars collection once executed.
SELECT * FROM cars
You can read more about accessing data within collections in Accessing Data.