Defining Relationships Using Embedding Method

You can select either of the following options to create relationships for collections in NoSQL databases:

  • Normalization
    Splits the fields in a collection into multiple collections based on the selected relationship type
  • Denormalization
    Embeds different collections into a single collection based on the selected embedding type

Normalization

You can use normalization to define relationships if the source collection has a primary key.

To define relationships using normalization, follow these steps:

  1. On the ribbon, click Actions > Normalization.
    The Normalization dialog box appears.
  2. Select appropriate values in the fields. Refer to the following table for field descriptions.

    Field

    Description

    Additional Information
    Auto NormalizationSpecifies whether the normalization should be through an auto-mechanismIndicates that the source collection is determined through an auto-mechanism
    Source

    Specifies the source collection for normalization

     
    Relationship Type

    Specifies the relationship type for normalization

    Auto: Indicates that a parent array forms one-to-many relationships with other child entities and a parent object forms one-to-one relationships with other child entities

    One to One: Indicates that one-to-one relationships are formed between entities

    One to Many: Indicates that one-to-many relationships are formed between entities

    No Relationship: Indicates that no relationship is formed between entities

    Cascading

    Specifies the factors based on which a collection is normalized into multiple collections

    All: Specifies whether all child levels in the source collection are normalized

    Levels: Specifies the number of levels at which a collection is normalized into separate collections. For example, if you set Level to 1, all fields up to level 1 in the hierarchy will be normalized into separate collections.

    Single Subitem: Specifies whether the different levels in a collection are considered as a single sub-item for normalization. This option applies to collections with multiple levels of sub-items.

    Auto Cleanup: Specifies whether the source collection should be deleted after normalization

  3. Click OK.
    The source collection is split into multiple collections.

Denormalization

To define relationships using denormalization, follow these steps:

  1. On the ribbon, click Actions > Denormalization.
    The Denormalization dialog box appears.
  2. Select appropriate values in the fields. Refer to the following table for field descriptions.

    Field

    Description

    Additional Information
    Auto Denormalization

    Specifies whether the denormalization must be through an auto-mechanism

    Indicates that the source and target collections are determined through an auto-mechanism

    TargetSpecifies the target collection for embedding 
    Source

    Specifies the source collection for embedding

     
    Embedding Type

    Specifies the embedding type for denormalization

    Embed as Auto: Indicates that the collections with one-to-many relationships are embedded as arrays and collections with one-to-one relationships are embedded as objects into a single collection

    Embed as Array:Indicates that the source collections are embedded into the target collection as arrays

    Embed as Object: Indicates that the source collections are embedded into the target collection as objects

    CascadingSpecifies the factors based on which multiple collections are merged into a single collectionAll: Specifies whether the collections at all relationship levels are denormalized into a single collection

    Levels: Specifies the number of levels up to which collections are denormalized into one collection. For example, if you set Level to 1, all the collections up to level 1 in the relationship hierarchy will be denormalized into a single collection

    Auto Cleanup

    Specifies whether the source collection should be deleted after denormalization

     
  3. Click OK.
    The collections are embedded into the single target based on the embedding type.