You can manually define relationships between fields across different collections in your Compass entity-relationship diagram.
Note
Relationships are for annotation purposes only. Compass does not store relationship information in your MongoDB database.
About this Task
You can manually add relationships to your entity-relationship diagram by using one of the following methods:
Side Panel: Manually add a relationship by selecting a source collection.
Drag and Drop: Create a relationship by clicking and dragging from one collection to another.
Before You Begin
To add relationships, ensure you have already generated a diagram.
Steps
To learn how to add relationships to your entity-relationship diagram, select the tab corresponding to your preferred method:
Specify Relationship Properties
Specify values for the following fields under Relationship Properties:
Local collection: The primary collection in the relationship.
Local field: The field in the primary collection.
Local cardinality: The number of unique values in the local field.
Foreign collection: The target collection in the relationship.
Foreign field: The field in the target collection.
Foreign cardinality: The number of unique values in the foreign field.
Compass automatically saves and updates your changes as you make them.
Specify Relationship Properties
Specify values for the following fields under Relationship Properties:
Local collection: The primary collection in the relationship.
Local field: The field in the primary collection.
Local cardinality: The number of unique values in the local field.
Foreign collection: The target collection in the relationship.
Foreign field: The field in the target collection.
Foreign cardinality: The number of unique values in the foreign field.
Compass automatically saves and updates your changes as you make them.
After you create a relationship, Compass displays each relationship in the Relationships tab.
Delete Relationships
To delete a relationship from your entity-relationship diagram: