Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /

Generate an Entity-Relationship Diagram in Atlas

Generate a visualization of your data model as an entity-relationship diagram in Atlas. Entity-relationship diagrams can help you understand and document the relationships between data in your database and plan changes to your schema.

If you make any changes to your data after you generate a diagram, Atlas doesn't automatically update the diagram. You must create a new diagram to see your changes.

To generate an entity-relationship diagram in Atlas, your database must have at least one collection with data.

1
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Data Explorer under the Database heading.

    The Data Explorer displays.

2

In the left sidebar, click Data Modeling.

3

If you have existing diagrams saved in the Data Modeling tab, you can create a new diagram by clicking Generate new diagram in the upper-right corner of the screen.

4

In the New diagram setup modal:

  • Select which MongoDB connection to use to generate your diagram.

  • Select which database to use for your data model diagram.

  • Input a name for your diagram.

After you specify each field, click Next.

5

Use the checkboxes to select which collections to include in your data model diagram. You can also use the search bar to filter for specific collections.

After you select your collections, click Next.

6

In the Diagram Settings modal, you can choose whether you want Atlas to Automatically infer relationships between collections. When enabled, Atlas analyzes the selected collections and adds relationships based on indexed fields that contain references to other collections.

You can also manually add and edit relationships after you generate your diagram.

Note

Relationships are for annotation purposes only. Atlas does not store relationship information in your MongoDB database.

7

In the Diagram Settings modal, you can specify how many documents Atlas samples from your collections to generate your diagram. By default, Atlas samples 100 documents per collection.

Larger sample sizes improve accuracy but may increase analysis time and memory usage. Smaller sample sizes decrease analysis time and memory usage but may miss infrequent fields or relationships.

You can also select whether you want to generate a diagram that samples all documents in your collections. Consider the size of your dataset and available resources on your device before you select All documents.

8

Atlas generates an entity-relationship diagram with the selected collections and displays it in the current tab. Atlas also displays the side panel where you can rename your diagram and view the following information:

  • The database you used to generate your diagram

  • When you first generated the diagram

  • When you last updated your diagram

After you generate a diagram, Atlas displays the existing diagrams in the Data Modeling tab.

Note

If you click a collection or field in your diagram, the side panel displays information about the collection or field. To go back to the Data Model Overview, deselect the collection or field by clicking the empty space in your diagram.

Back

Visualize Your Data Model

On this page