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.
A collection is the home of one type of records. It is two things side by side:
- the collection page
<folder>.mdwithtype: 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.mdfile 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
| Norm | What it means | Enforcer (check) |
|---|---|---|
| SCH-R01 | A relation field points to an existing record of the collection that the schema names | relations |
| SCH-R02 | A select value is from the schema list; a date, a number and a checkbox are of the right kind | values |
| SCH-R03 | The fields the schema requires (required, requiredWhen) and the record title are filled | required |
The package Collections puts this page at
/base/collections.md.Source text