Data Modelling in MongoDB (original) (raw)

Last Updated : 5 May, 2026

MongoDB data modeling focuses on structuring documents and collections in a way that matches application access patterns, improves query performance, and supports future scalability using MongoDB’s flexible schema.

database

Data Modeling

MongoDB Data Model Designs

For modeling data in MongoDB, two strategies are available. These strategies are different and it is recommended to analyze scenario for a better flow. The two methods for data model design in MongoDB are:

1. Embedded Data Model

The Embedded Data Model stores related data within a single MongoDB document, improving read performance by keeping frequently accessed information together and reducing the need for joins.

**Embedded Data Model example

If we obtain student information in three different documents, Personal_details, Contact, and Address, we can embed all three in a single one, as shown below.

{
_id: ObjectId(),
Std_ID: "987STD001",
Personal_details: {
First_Name: "Ron",
Last_Name: "Smith",
Date_Of_Birth: "1999-08-26"
},
Contact: {
email: "ron_smith.123@gmail.com",
phone: "9987645673"
},
Address: {
city: "Karnataka",
Area: "BTM2ndStage",
State: "Bengaluru"
}
}

**Advantages of the Embedded Model:

**Disadvantages:

2. Normalized Data Model

The Normalized Data Model stores related data in separate collections and links them using references, reducing duplication and supporting complex relationships across collections.

**Normalized Data Model Example

Created multiple collections for storing students data which are linked with _id.

Student:

{
_id: ,
Std_ID: "10025AE336"
}

Personal_Details:

{
_id: ,
stdDocID: "StudentId101",
First_Name: "Ron",
Last_Name: "Smith",
Date_Of_Birth: "1999-08-26"
}

Contact:

{
_id: ,
stdDocID: " StudentId101",
e-mail: "ron_smith.123@gmail.com",
phone: "9987645673"
}

Address:

{
_id: ,
stdDocID: " StudentId101",
city: "Karnataka",
Area: "BTM2ndStage",
State: "Bengaluru"
}

**Advantages of the Normalized Model:

**Disadvantages:

Advantages Of Data Modeling in MongoDB

Data modeling in MongoDB helps design efficient schemas that improve performance, simplify development, and support long-term scalability and maintenance.

Best Practices

Some important points to consider while creating a data model for MongoDB database are: