Skip to main content

Command Palette

Search for a command to run...

What is a Document in MongoDB?

Updated
1 min read
What is a Document in MongoDB?
R

Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, though it contains more data types than JSON. MongoDB documents are composed of field-and-value pairs. The value of a field can be any of the BSON data types, including other documents, arrays, and arrays of documents.

{
   _id: ObjectId("5099803df3f4948bd2f98391"), 
  name: { first: "Alan", last: "Turing" }, 
  birth: new Date('Jun 23, 1912'), 
  death: new Date('Jun 07, 1954'), 
  contribs: [ "Turing machine", "Turing test", "Turingery" ], 
  views : NumberLong(1250000) 
}

Sources:

Documents — MongoDB Manual. www.mongodb.com/docs/manual/core/document.

More from this blog

R

Raja Muhammad Asher - Senior Software Engineer - Full Stack Developer

157 posts

Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, ExpressJS, MySQL, MongoDB. Love collaborating & making a difference