Linked documents
A linked document field is a field referencing another document or documentVersion. A linked document field is defined by specifying the document id as type.
Single value field
We’re creating a definition to save job applications, however the data from the application is saved separately, e.g. a reference to the job application, but also the applicants information.
The following applicant
definition will reference existing vacancy within the dataset jobs
as well as the applicant, which is saved as a user document in dataset hr
.
document-definition:
name: applicant
content:
- id: applicant
type: 'document(hr:user)' (1)
- id: vacancy
type: 'document(jobs:vacancy@2)' (2)
1 | Reference to a document which uses a definition with full key hr:user . |
2 | Reference to a document which uses version 2 of the definition with full key jobs:vacancy . |
It is advised to wrap the type specifier in single or double quotes to ensure it is treated as a string and to avoid parsing errors.
|
The above example can also been written with the options-query
attribute, as shown below.
document-definition:
name: applicant
content:
- id: applicant
type: 'document'
attributes:
options-query: "type.key = 'user' and type.dataSet.key = 'hr'" (1)
- id: vacancy
type: 'document'
attributes:
options-query: "type.key = 'vacancy' and type.dataSet.key = 'jobs' and type.latestVersion.version = 2" (2)
1 | The equivalent of type: 'document(hr:user)' |
2 | The equivalent of type: 'document(jobs:vacancy@2)' |
Type specifier | Description |
---|---|
|
References a |
|
References a |
|
References a |
|
References a |
In the table above documentVersion can be used instead of document as well to reference documents that use a specific definition version, e.g. documentVersion(hr:user@2)
|