On this page: The types of documents available in TerminusDB with examples of their definitions and interactions.
@type
Player
@id
Player/George
@id
is unambiguous, for example, when used in the same collection, then @id
can be used as-is, i.e., as Player/George
. Otherwise, the @base
property is required.@base
terminusdb://Roster/schema#
Player/George
expanding to terminusdb://Roster/document/Player/George
.@id
. The parameters @key
and @base
are available in the class definition, enabling you to use a calculated @id
. Refer to the Schema reference for more information.Roster
class points to a Set
of Player
s (or Player
classes.)Set
property in the code-snippet is a type family allowing us to state that the player
property can have any number of Player
s attached. Set
does not provide ordering or multiplicity; a Player
is either connected or not connected. For ordering and multiplicity, use @type
List
or Array
.Roster
points to the various Player
documents. When requesting the document Roster/Wolves
, each player in the player
array is retrieved. Each identifier can be queried in a similar way to retrieve all associated documents.stats
. Stats
is declared a subdocument using the @subdocument
property and the special value []
. Also, it has a Random
key, meaning the key is automatically generated if not provided.Stats
with the Player
object. It is also possible for subdocuments to point recursively to other subdocuments or documents.