Containment Relationships
Go Up to Creating and Editing Relationships
A containment relationship is used for nested objects within a supported database. For instance, if you have reverse engineered nested objects within MongoDB, these will be added with a containment relationship to the object they are nested within.
To create a new containment relationship
- On the Data Model Explorer, click the Data Model tab.
- Choose Insert > Relationships > Containment Relationship, this changes the cursor icon and allow you to select the objects in the main window with which to create the relationship.
- Click on the object containing the other object.
- Click on the object contained within the previously clicked object.
Double clicking on the relationship line will open the Containment Relationship Editor where you can edit settings.
The 1 indicates a single nested object; * indicates an array.
Changing a relationship type for containment relationships in Google BigQuery and MongoDB
Google BigQuery and MongoDB users can easily change a relationship type for containment relationships. While viewing a containment relationship that you want to change the relationship type, click Switch Relationship Class in the ribbon bar. The following actions occur:
- If the line is referencing:
- ERDA removes the Foreign Key field/column in the child object/table.
- A dialog appears asking you to select the desired containing object, and offers Parent, Child, and Cancel options. Note that Child is the default.
- ERDA changes the relationship type to containing in the direction selected in the dialog.
- A new foreign key property is created in the Parent object.
- If the line is containing:
- ERDA removes the Foreign Key field/column in the parent object/table.
- A dialog appears asking you to select the desired referencing object, and offers Parent, Child, and Cancel options. Note that Parent is the default.
- ERDA changes the relationship type to Referencing in the direction selected in the dialog.
- A new foreign key property is created in the Child object, propagating the primary key of the parent.
The following image shows this feature using Google BigQuery:
The following image shows this feature using MongoDB: