www.mongodb.com Open in urlscan Pro
2600:9000:23ca:1800:7:7859:3840:93a1  Public Scan

Submitted URL: https://s413370795.t.en25.com/e/er?utm_campaign=Int_EM_Mid-Funnel%20Developer%20101%20Email%203_DM_04_21_WW&utm_medium=email&u...
Effective URL: https://www.mongodb.com/basics/data-models?utm_campaign=Int_EM_Mid-Funnel%20Developer%20101%20Email%203_DM_04_21_WW&utm_...
Submission: On September 20 via manual from FR — Scanned from US

Form analysis 2 forms found in the DOM

GET https://www.mongodb.com/search

<form role="search" method="GET" action="https://www.mongodb.com/search" class="css-dc0gsv">
  <div class="css-87svlz">
    <div class="css-36i4c2"><input type="text" placeholder="Search products, whitepapers, &amp; more..." value="" class="css-etrcff"></div>
    <div class="css-v2nqhr">
      <div class="css-aef77t"><button role="label" type="button" class="css-14k7wrz"><span data-testid="selected-value" class="css-6k4l2y">General Information</span>
          <div class="css-109dpaz"><svg data-testid="icon" width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg" class="css-1yzkxhp">
              <path d="M1.06689 0.799988L8.00023 7.73332L14.9336 0.799988" stroke-linecap="round" stroke-linejoin="round" class="css-1tlq8q9"></path>
            </svg></div>
        </button>
        <div class="css-hn9qqo">
          <ul data-testid="options" role="listbox" class="css-ac9zo2">
            <li role="option" tabindex="0" class="css-11dtrvq">General Information</li>
            <li role="option" tabindex="0" class="css-11dtrvq">All Documentation</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Realm Documentation</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Developer Articles &amp; Topics</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Community Forums</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Blog</li>
          </ul>
        </div>
      </div><input type="hidden" id="addsearch" name="addsearch" value="">
      <div class="css-1myrko"><button type="submit" tabindex="0" data-track="true" class=" css-13l1z36"><img alt="search icon" src="https://webimages.mongodb.com/_com_assets/cms/krc3hljsdwdfd2w5d-web-actions-search.svg?auto=format%252Ccompress"
            class="css-r9fohf"></button></div>
    </div>
  </div>
</form>

GET https://www.mongodb.com/search

<form role="search" method="GET" action="https://www.mongodb.com/search" class="css-11a71ad">
  <div class="css-7590ag"><input type="text" placeholder="Search products, whitepapers, &amp; more..." value="" class="css-xrkki1"></div>
  <div class="css-abpu8v"><select id="filter-select" class="select-overlay css-15v6p12">
      <option selected="" value="General Information">General Information</option>
      <option value="All Documentation">All Documentation</option>
      <option value="Realm Documentation">Realm Documentation</option>
      <option value="Developer Articles &amp; Topics">Developer Articles &amp; Topics</option>
      <option value="Community Forums">Community Forums</option>
      <option value="Blog">Blog</option>
    </select><input type="hidden" id="addsearch" name="addsearch" value="">
    <div class="css-1myrko"><button type="submit" tabindex="0" data-track="true" class=" css-31biy7">Search</button></div>
  </div>
</form>

Text Content

Blog
{Blog}  See what’s new with MongoDB 6.0 — and why you’ll want to upgrade today
>>
General Information

 * General Information
 * All Documentation
 * Realm Documentation
 * Developer Articles & Topics
 * Community Forums
 * Blog


 * Products
   Atlas→
   
   Developer Data Platform
   
   --------------------------------------------------------------------------------
   
   Enterprise Advanced→
   
   Enterprise software and support
   
   --------------------------------------------------------------------------------
   
   Community Edition→
   
   Free software used by millions
   
   --------------------------------------------------------------------------------
   
    * Database→
    * Search→
    * Data Lake (Preview)→
    * Charts→
    * Device Sync→
    * APIs, Triggers, Functions→
   
    * Enterprise Server→
    * Ops Manager→
    * Enterprise Kubernetes Operator→
   
    * Community Server→
    * Cloud Manager→
    * Community Kubernetes Operator→
   
   
   Tools→
   
   Build faster
   
   --------------------------------------------------------------------------------
   
    * Compass→
    * Shell→
    * VS Code Plugin→
    * Atlas CLI→
    * Database Connectors→
    * Cluster to Cluster Sync→
    * Mongoose ODM Support→
   
   
 * Solutions
   
   By Industry
   
   
   
   --------------------------------------------------------------------------------
   
   By Use Case
   
   
   
   --------------------------------------------------------------------------------
   
    * Financial Services→
    * Telecom→
    * Healthcare→
    * Retail→
    * Gaming→
    * All Industries→
   
    * Analytics→
    * Internet of Things→
    * Mobile→
    * Payments→
    * Serverless Development→
    * All Use Cases→
   
   
   
   Customer Stories
   
   Learn how businesses are taking advantage of MongoDB
   
   View All
   
   --------------------------------------------------------------------------------
   
   White Papers & Presentations
   
   Webinars, white papers, data sheet and more
   
   View All
 * Resources
   Documentation→
   
   
   
   --------------------------------------------------------------------------------
   
    * Atlas→
    * Server→
    * Drivers→
   
    * Develop Applications→
    * Launch and Manage MongoDB→
    * View and Analyze→
    * Start with Guides→
   
   
   
   Community
   
   
   
   --------------------------------------------------------------------------------
   
   Education
   
   
   
   --------------------------------------------------------------------------------
   
    * Developer Center→
    * Events & Webinars→
    * Forums→
    * Champions→
    * Find a User Group→
   
    * University→
    * Certification→
    * Academia→
    * MongoDB Basics Course→
    * Browse All Courses→
   
   
 * Company
   
   About
   
   
   
   --------------------------------------------------------------------------------
   
   Services
   
   
   
   --------------------------------------------------------------------------------
   
   Partnerships
   
   
   
   --------------------------------------------------------------------------------
   
    * Who We Are→
    * Blog→
    * Careers→
    * Pressroom→
    * Leadership→
    * Investors→
   
    * Consulting→
    * Training→
    * Enterprise Support→
   
    * Become a Partner→
    * Find a Partner→
    * MongoDB for Startups→
   
   
 * Pricing

Sign In
Try Free

General InformationAll DocumentationRealm DocumentationDeveloper Articles &
TopicsCommunity ForumsBlog
Search


WHAT IS DATA MODELING?

A good data model will help you understand the business requirements for your
application and structure your schema. MongoDB Atlas allows for schema
flexibility to match your application requirements.
Get started free with Atlas

Why is having a good data model essential from the start of your project? Any
modern application needs data to run, but how you model your data will have a
drastic impact on the performance of your application, as well as the speed of
development. In this article, you will learn what data models are, why you need
them, and how to create a data model to be used with MongoDB.

Table of Contents

 * What are Data Models?
 * What are Data Models Used For?
 * What are the Different Types of Data Model?
 * What is the Data Modeling Process?
 * Data Model Examples
 * Data Modeling Tools
 * FAQ


WHAT ARE DATA MODELS?

A data model is a visual representation of how you will store data, along with
how the data is related to each other. The goal of creating a data model is to
identify all the data components of a system and how they are linked together.

The fact that MongoDB has a flexible schema doesn’t mean that you don’t need
data modeling or schema design. Instead, a good data model means that you will
establish a strong foundation for an ever-evolving data model that will adapt as
your requirements change. By creating a solid data model right from the start,
you can ensure that your application will perform better and be more
future-proof.


WHAT ARE DATA MODELS USED FOR?

A data model provides you with the foundation for the data structure of your
application. Creating the data model can help you to identify the business rules
that your application will need to follow. The data model will also provide your
development team with a consistent map of the data used by the application they
are developing.

Thinking ahead of time about how you will access the information from the
application will help you plan better. It will also help you understand the
business processes that are sometimes hidden or not explicitly explained by your
stakeholders.

While data modeling might seem like an additional step in the development
planning cycle, it can make the development cycles much faster.


WHAT ARE THE (THREE) DIFFERENT TYPES OF DATA MODELS?

As you start modeling your data, you will likely go through various steps of
data analysis. Each step might produce different types of data models.
Therefore, data models can be generally thought of as being one of the three
following types.

 * Conceptual Data Model: The conceptual data model explains what the system
   should contain with regard to data and how it is related. This model is
   usually built with the help of the stakeholders. It represents the
   application’s business logic and is often used as the basis for one or more
   of the following models.

 * Logical Data Model: The logical data model will describe how the data will be
   structured. In this model, the relationship between the entities is
   established at a high level. You will also list the attributes for the
   entities represented in the model.

 * Physical Data Model: The physical data model represents how the data will be
   stored in a specific database management system (DBMS). With this model, you
   would establish your primary and secondary keys in a relational database or
   decide whether to embed or link your data in a document database such as
   MongoDB. You will also establish the data types for each of your fields. This
   will provide you with your database schema.

These models are created using entity-relationship diagrams (ERD). An example of
these three models can be found in the section titled What is an example of a
data model? below.


WHAT IS THE DATA MODELING PROCESS?

You can think of data modeling as a series of steps, each one providing you with
one of the models described above.

The first step to a data modeling process is to gather all the requirements for
your application. This step will provide you with the underlying data structure
that you will need to review. Analyze not only the data objects, but also the
size of the data and the operations that will be performed on that data. This
step will be done with the help of domain experts. At the end of this first
step, you should have the necessary information to draft your conceptual data
model.

The next step is to understand the relationship between the various entities
that make up your whole data model. Try to think about how the objects would be
related and the attributes you would use to describe these objects. This step
will provide you with your logical data model. Finally, you can start thinking
about the actual data that you will store in the database. At this point, you
will try to identify unique keys and field types. The way you model your data
will depend highly on the type of DBMS you will be using. If you are using a
relational database, you might start thinking about normalizing your data while
you would think about embedding related information in a document database. At
the end of this step, you can produce a physical data model representing your
initial database.


WHAT IS AN EXAMPLE OF A DATA MODEL?

Let’s imagine a scenario where you would build an application for the users of a
library. How would you model this database?

First, you will speak with the business analysts to understand the entities that
need to be part of your system. You’ll find out that these must be included:

 * Books: The library has millions of books, and they all have a unique
   International Standard Book Number (ISBN). The users will need to search
   books by title or by author.
 * Users: This library has thousands of users, and each user has a name, along
   with an address. The library will assign them a unique number that they can
   find on their library card.

You will also need to understand how the various entities will interact with
each other. These interactions will give you the relationships in your model. In
the case of the library example, interactions might look like:

 * Users will borrow books: Ultimately, the library will need to know which
   books have been borrowed by which user. Each user is entitled to five
   borrowed books at a time.

These business rules will let you organize the information to build your
conceptual model. By now, you understand the data necessary to build the first
iteration of your software.



Figure 1: The conceptual model

It is now time to create a logical data model. As part of this modeling step,
you might realize that some of your data structures are more complex and require
new entities. For example, the authors would be better represented as their own
entities in order to enable searching for books by authors. We are assuming here
that there is a single author per book for the sake of simplicity.

The relationships between the various objects that form the data model also
start to emerge from this model.



Figure 2: The logical model

It is now time to choose your DBMS and build your physical data model. At this
point, you will start thinking in terms of the database you picked. The type of
database you choose will determine how you will store the data.

If you use a document database, such as MongoDB, you will model relationships
using embedding or document references. As you establish the relationships
between your various objects, you will also find your IDs and unique values
representing your items.

Let’s return to our library example. In the following diagram, you can see that
the author was embedded in the books. This will make it easier to create indexes
to enable the full-text search capabilities of MongoDB Atlas Search. The books
borrowed are listed as an array in the user document because this information
will be generally retrieved all at once on the application’s main page. A
different use case with this same library data might have called for a different
physical data model. The ISBN and CardNum fields are unique for the documents
and could be used as the ID field. You could also use them as a sharding key if
you need to scale to multiple clusters.



Figure 3: The physical data model for a document database

If you decide to go with a traditional relational database, the physical data
model will look very different. In this example, the authors and books table are
linked through a one-to-many relationship. The authorId field is the primary key
in the authors’ table, and the authorId field would be the foreign key in the
books table. A joint table is added to keep track of the borrowed books along
with the due dates.



Figure 4: The physical data model for a relational database

Now that you’ve been through these stages, you have an entire database model
that describes how to store your entities and create relationships amongst them.
Those steps also gave you some insights into what should be your keys and your
indexes.


WHAT DATA MODELING TOOLS ARE AVAILABLE?

The example above was simple enough to be represented by a simple drawing tool.
As your data models get more complex, you might need to rely on more advanced
tooling to represent the data you are trying to map.

 * Hackolade is a general purpose tool that can help you create visual
   representations of your data for relational or document databases. It can
   even be used to create your MongoDB schemas and get you up and running
   faster.

 * If you are looking for a free and open-source tool, you can look at Open
   ModelSphere, a powerful software that lets you create just about any possible
   model.

 * If a collaborative design is more important, consider Creately, a general
   design tool that lets you work in real time with other contributors on your
   models.

All of these tools use standard universal markup language (UML) to build your
ERDs and will provide you with professional-looking diagrams that can then be
shared with your team.


FLEXIBLE DATA MODELING WITH MONGODB ATLAS

MongoDB provides you with a flexible schema for your data. This flexible schema
means that you can easily change your data structure as your application
progresses and the requirements change. This doesn’t mean that you shouldn’t
think about data modeling, though. A good data model will help you understand
the business requirements for your application and structure your schema to
optimize your queries.

As you model your data, think about how the data will be displayed and used in
your application. The way you use the data should dictate the structure of your
database, and not the other way around. This is why MongoDB is easier to use for
software developers. Try it out for yourself with MongoDB Atlas, MongoDB's fully
managed database-as-a-service (DBaaS).


NEXT STEPS

Now that you know how to model your data, you can create a MongoDB Atlas cluster
and build your database. You can find out more about data modeling from the Data
Modeling with MongoDB presentation from MongoDB.live 2020. There is also a
course available on that specific topic at MongoDB University.

A good data analysis phase will help you plan out how you should structure your
data. It will also help you identify what your indexes should be, leading to an
overall better application. Once you are familiar with data modeling for
MongoDB, you will also need to understand how to create good data schemas and
apply patterns to make your database even more efficient. Once you master those
skills, you will be able to create applications that are faster and more
scalable.


READY TO GET STARTED?

TRY IT OUT FOR YOURSELF WITH MONGODB ATLAS, MONGODB'S FULLY MANAGED
DATABASE-AS-A-SERVICE (DBAAS).

Start Now


FAQ


WHAT IS A DATA MODEL?

A data model is a visual representation of how you will store data in a
database, along with how the data is related together. The goal of data modeling
is to identify all the data components of a system and how they are linked
together.



WHAT ARE THE DIFFERENT TYPES OF DATA MODELS?

Data models are usually found in three different types: the conceptual model,
the logical model, and the physical data model. A data model can be produced at
various points in the software analysis process.



WHAT ARE DATA MODELS USED FOR?

A data model provides you with the foundation for the structure of your data.
Data modeling can help you to identify the business rules that your application
will need to follow. It will also provide your development team with a
consistent map of the data used by the application they are developing.

English

 * English
 * Português
 * Español
 * 한국어
 * 日本語
 * Italiano
 * Deutsch
 * Français
 * 简体中文

© 2022 MongoDB, Inc.

About

 * Careers
 * Investor Relations
 * Legal Notices
 * Privacy Notices
 * Security Information
 * Trust Center

Support

 * Contact Us
 * Customer Portal
 * Atlas Status
 * Paid Support

Social

 * Github
 * Stack Overflow
 * LinkedIn
 * Youtube
 * Twitter
 * Twitch
 * Facebook

© 2022 MongoDB, Inc.