Each MongoDB key:value pair must have a unique key at each nesting level in a document.
It means that the keys can be used at different nesting levels in a document.
Each MongoDB document must have a unique identifier within a collection. A value of identifier is associated with a key "_id".
Each MongoDB collection must have a unique name within a database
A document listed below has an identifier automatically generated by a method ObjectId().
{"_id": ObjectId(),
A key "full name" is associated with a document that consists of 3 key value pairs. Note that there is no need to create a new document
identifier for a document associated with a key "full name".
"full name": {"first name":"James",
"initials":null,
"last name":"Bond"},
A key "employee number" is associated with a value "007"
"employee number":"007",
A key "skills" is associated with an array of strings.
"skills":["cooking", "painting", "gardening"],
A key "cars owned is associated with an array of documents. Each document in the array consists of two key:value pairs.
"cars owned":[ {"rego":"007-1",
"made":"Porsche"},
{"rego":"007-2",
"made":"Ferrari"} ],
A key "secret codes" is an array of two arrays of numbers. It can also be interpreted as a 2-dimensional array of 2 rows and 4 columns.
"secret codes":[ [1,2,3,4],
[9,8,7,5] ],
A key "date of birth" is associate with a value of type "date". To create such value a constructor Date must be used.
"date of birth":new Date("1960-01-01")
}