Fields
A document consists of sets of fields that self-describe the data it encodes. Each set signifies a single pair of two associated elements:
- The name identifying the field.
- The value that holds the data.
Similar to most document-oriented databases, you can only use strings to encode field names in documents.
For complete naming rules, see IDs, Paths, Strings, and Keywords.
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, including scalar type, providing flexibility in representing a wide range of information.
Data types provide flexibility in representing a range of information and consist of a merge behavior plus a scalar value. Data types include REGISTER, MAP, and ATTACHMENT
In the following structure, the location field property is logically grouped with details about the car, such as its make, year, and color.
It contains nested fields. also referred to as subfields, representing both the coordinates and the address where the car is located: