package page→ /base/collections.md
pages/base/collections.md
47 lines, 2.1 KB. As a page.
- ---
- type: Page
- title: "Collections"
- icon: "🗂️"
- description: "What a collection is: a folder of pages of one type and a page that describes their fields, place and kinds."
- ---
- A **collection** is the home of one type of records. It is two things side by side:
- - the collection page `<folder>.md` with `type: Collection`: it holds the whole definition: the type of records (`itemType`), where they lie (`items`, `writeTo`), their fields (`properties`) and the saved kinds (`views`);
- - the folder `<folder>/` with the records: one `.md` file per record, and the record has the same type in its header and the fields by the schema.
- A collection is also the fact itself that such records are kept: a task collection is not only a view of tasks but also the fact that the project keeps tasks.
- The collection page lies no deeper than one folder from the root: `<layer>.md` or `<layer>/<name>.md`. The records are in the folder of the same name next to it.
- ## Example
- ```yaml
- ---
- type: Collection
- title: Tasks
- itemType: Task
- items: {mode: path, path: /work/tasks}
- writeTo: /work/tasks
- properties:
- initiative: {kind: relation, collection: /work/initiatives, label: "Initiative"}
- dependsOn: {kind: relation, collection: /work/tasks, multiple: true, label: "Depends on"}
- priority:
- kind: select
- label: "Priority"
- options:
- - {name: high, label: "High"}
- - {name: low, label: "Low"}
- doneWhen: {kind: text, label: "Done when", required: true}
- ---
- ```
- Which kinds of fields there are: [Kinds of fields](/base/fields.md).
- ## Enforcers of the norms
- | Norm | What it means | Enforcer (check) |
- |---|---|---|
- | [SCH-R01](/norms/rules/collections/SCH-R01.md) | A relation field points to an existing record of the collection that the schema names | `relations` |
- | [SCH-R02](/norms/rules/collections/SCH-R02.md) | A select value is from the schema list; a date, a number and a checkbox are of the right kind | `values` |
- | [SCH-R03](/norms/rules/collections/SCH-R03.md) | The fields the schema requires (`required`, `requiredWhen`) and the record title are filled | `required` |