Platform Manual
Document Model

Collections

At a high level, Ditto queries execute on specific collections and are utilized to filter and narrow down the contents of those collections.

A collection is a set of documents categorized together. For example, you would group all documents related to cars in a "cars" collection.

Creating a Collection

Using ditto.store.collection and upsert methods, create your collection. For example, cars:

For more information, see CRUD Operations.

pseudocode


Referencing a Collection

Instead of inspecting the many fields that documents contain, you can reference a shared collection making it easy to retrieve and store information.

Ditto syncs and queries documents using a combination of collection name and document identifier. The document ID serves as the primary identifier within the collection.

As long as a collection contains at least one document, you can continue referencing it.

Following is an example of a reference to cars in a replication query using the find method:

pseudocode