DEV Community

Cover image for What is a Document in MongoDB?
Coding Jitsu
Coding Jitsu

Posted on

3 2

What is a Document in MongoDB?

Alt Text

Let's take a closer look at what documents are and how they're used to store data in a structured way.

A document is a way to organize and store data as a set of field-value pairs.

Just like the below object, where the field is a unique identifier for some data point, and the value is data related to a given identifier.

{
 <field> : <value>,
 <field> : <value>,
 "name"  : "Raju",
 "title" : "Team Leader",
 "age"   : "26"
}
Enter fullscreen mode Exit fullscreen mode

In this example, there is a field name, and the value is Raju.

We will look closer at documents and their structures once we get our hands on an actual data set.

But for now, this is a simple example of a document.

A collection would contain many documents similar to this one.

And a database would contain multiple collections.

In this post, I defined what document and collection mean in MongoDB.

In the next post, I will start querying collections for documents and interact with the database in general.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay