Structure and Syntax of MongoDB Document

  • A document in MongoDB uses the JavaScript Object Notation (JSON) format. This format uses curly bracket to mark the start and the end of the document.
  • MongoDB refers to the keys as fields.
  • The field value pairs in a document are separated by colon (:)
  • Each field must be enclosed within quotation marks. String values are often quoted as good practice.
  • Each field value pair is separated withing the document by commas ( , )

Sample Document

{
  "_id": 1,
  "user_id": "Jack",
  "age": 40,
  "Status": "Active"
}