The document, which is comprised of field/value pairs, is at the heart of the MongoDB data structure. Most interactions with MongoDB occur at the document level.
A field can contain a single value, multiple fields, or multiple elements.
A value made up of multiple fields is referred to as an embedded document and is assigned the Object data type (see field
cars in the screenshot). When rendered in the JSON format, an embedded document is enclosed in curly braces and adheres to the same structure as the outer (main) document.
A value made up of multiple elements is referred to as an array and is assigned the Array data type (see field
Profession in the screenshot). When rendered in the JSON format, an array is enclosed in square brackets, with each element separated by a comma. An element can be a scalar value (like in the field
Profession) or an embedded document (like in the field
A field can be one of these MongoDB data types:
Not surprisingly, there’s much more to the document data structure than what is covered here. For more in-depth information, see the topics Databases and Collections and Documents in the MongoDB manual.