Docs Menu
Docs Home
/ /

Data Modeling in MongoDB Compass

The data modeling experience in Compass allows you to create an entity-relationship diagram that visualizes collections, their fields, data types, and their relationships within a single database. With this, you can better understand how your data is structured and connected, making it easier to develop applications, collaborate with team members, and maintain evolving data models.

The data modeling experience in Compass can be useful in the following scenarios:

  • Data visualization: Generate an entity-relationship diagram of your current data model. Visualizing your data model can help you identify impacts of potential schema changes across related collections.

  • Data model planning: Track and plan changes to your data structure as your application grows. Visualizing your data model can help you identify potential impacts of schema changes across related collections.

  • Cross-team collaboration: Share visual representations of your data model with data engineers, product managers, and other stakeholders to ensure everyone understands the current state of your database structure. You can share your data model as an image, JSON file, or .mdm file that can be opened directly in Compass.

  • Application development: Identify inconsistencies, missing relationships, or optimization opportunities in your data model during the development process.

  • Team member onboarding: Quickly understand existing data models when onboarding onto a new project or working with collections created by other teams.

Compass generates an entity-relationship diagram based on a small sample of documents from each collection you select in your database. Due to this sampling, your diagram might not reflect all fields or relationships in your data.

  • Generate an Entity-Relationship Diagram in Compass

  • Modify Collections in Your Compass Entity-Relationship Diagram

  • Modify Fields in Your Compass Entity-Relationship Diagram

You can add comments to your diagram's collections, fields, and relationships to document definitions or data modeling decision.

You can define relationships between fields in different collections in your entity-relationship diagram. When you create an entity-relationship diagram, you can opt for Compass to automatically infer relationships. You can also manually add relationships.

Note

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

You can export your Compass entity-relationship diagram. By sharing your diagram, you can collaborate with various teams, receive feedback, and align on final schema design decisions.

You can export your diagram as a:

  • .mdm Diagram File.

  • PNG image.

  • JSON file.

You can also import Compass an entity-relationship diagram that was exported as a .mdm file. By importing an entity-relationship diagram, you can view or edit a diagram shared by a collaborator.

  • Data Modeling

Back

Import & Export Data

On this page