Bando Documentation
Documents and relations
Understand the difference between a collection and a document, and learn how to relate documents.
Collection vs. document
This is one of the most important distinctions in Bando.
A collection describes the structure. Adocument is a concrete record of that structure.
If the collection is posts, we can have documents such as:
Document structure
Bando works with documents that contain information about the record itself and the data defined by the collection.
ididentifies the document.collectionindicates which collection it belongs to.datacontains the fields defined by the collection.createdAtindicates when it was created.updatedAtindicates when it was updated.
Relations
A relation allows a document to reference another document.
Imagine that every post has an author. Instead of duplicating all the author's information inside the post, we can store a reference to a document in the authors collection.
The flow can be understood like this:
One relation to multiple documents
When a document can reference multiple documents, usemultiple: true.