ShtukbaseStandard
page/base/collections.md

Collections

What a collection is: a folder of pages of one type and a page that describes their fields, place and kinds.

Page fields (1)
icon🗂️

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

---
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.

Enforcers of the norms

NormWhat it meansEnforcer (check)
SCH-R01A relation field points to an existing record of the collection that the schema namesrelations
SCH-R02A select value is from the schema list; a date, a number and a checkbox are of the right kindvalues
SCH-R03The fields the schema requires (required, requiredWhen) and the record title are filledrequired
The package Collections puts this page at /base/collections.md.Source text