ShtukbaseStandard
package page→ /base/collections.md

pages/base/collections.md

47 lines, 2.1 KB. As a page.

  1. ---
  2. type: Page
  3. title: "Collections"
  4. icon: "🗂️"
  5. description: "What a collection is: a folder of pages of one type and a page that describes their fields, place and kinds."
  6. ---
  7. A **collection** is the home of one type of records. It is two things side by side:
  8. - 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`);
  9. - 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.
  10. 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.
  11. 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.
  12. ## Example
  13. ```yaml
  14. ---
  15. type: Collection
  16. title: Tasks
  17. itemType: Task
  18. items: {mode: path, path: /work/tasks}
  19. writeTo: /work/tasks
  20. properties:
  21. initiative: {kind: relation, collection: /work/initiatives, label: "Initiative"}
  22. dependsOn: {kind: relation, collection: /work/tasks, multiple: true, label: "Depends on"}
  23. priority:
  24. kind: select
  25. label: "Priority"
  26. options:
  27. - {name: high, label: "High"}
  28. - {name: low, label: "Low"}
  29. doneWhen: {kind: text, label: "Done when", required: true}
  30. ---
  31. ```
  32. Which kinds of fields there are: [Kinds of fields](/base/fields.md).
  33. ## Enforcers of the norms
  34. | Norm | What it means | Enforcer (check) |
  35. |---|---|---|
  36. | [SCH-R01](/norms/rules/collections/SCH-R01.md) | A relation field points to an existing record of the collection that the schema names | `relations` |
  37. | [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` |
  38. | [SCH-R03](/norms/rules/collections/SCH-R03.md) | The fields the schema requires (`required`, `requiredWhen`) and the record title are filled | `required` |