Fields and Map Key-Values
A document consists of sets of fields that self-describe the data it encodes. Each set signifies a single pair of two associated elements:
Required and randomly generated and assigned by default upon creation, the first set of fields identify the document. For more information, see Identifier: Default and Custom, as follows.
Similar to most document-oriented databases, you can only use strings to encode field names in documents.
If you attempt to insert a type other than a string for a field property, as demonstrated in the following snippet, you will receive an error message:
Values can be encoded using various data types, providing flexibility in representing a wide range of information. However, the supported data types depend on the type of CRDT you are using:
- For a register, use any type: such as strings, numbers, objects, or even binary data.
- For a counter, use only a number.
- If embedding a map, use key-value pairs within the embedded structure.
Sort results by specific order by using the sort method to specify the field to match and the order want matching query results to be arranged.
By default, queries that do not include a sort operation, filter by document ID.
Restrict the number of results returned by your query by using the limit method to specify the number of results you want to return.
Establishes a parent-child hierarchy between data elements where the key serves as the parent and the associated values the children to link related data items as well as organize them in a structure that enhances efficiency of lookup.