A policy can have both several insurable objects to cover and several parties' agreements involved. For instance, a policy may have many parties involved, and each party might be part of multiple policies. This results in a many-to-many relationship between roles and agreements.
Similar to the Party domain, you can embed this information under the
MongoDB policy document by adding mappings for each table in the relational
database.
About this Task
The Policy domain includes the following key entities:
Insurable Object: An object insured by a policy agreement.
Insurable Object Party Role: An associative entitiy which links the following entities:
Party
Party Roles
Insurable Objects
Agreement Party Role: An associative entity which links the following entities:
Parties
Party Roles
Agreements (which are related to a product and policy)
The following image shows the Entity Relationship Diagram (ERD) for the Policy domain:

Before You Begin
Refactoring the Policy domain is the third step of the insurance data model example tutorial. Before you refactor the Party domain, ensure that you connected to your PostgreSQL database in Relational Migrator and refactored the Party domain.
Steps
Embed policy_coverage_detail information under the policyCoverageParts collection
Each coverage part has details included in the policy_coverage_detail
table. To embed this information, click Add and select
Embedded array. Choose policy_coverage_detail
from the Source table drop-down menu and ensure that the
Root path prefix is policyCoverageParts.
Under the All fields checkbox, uncheck the
policyIdentifier and coveragePartCode fields, and click
Save and close.
Embed policy_limit and policy_deductible information
To include policy_limit information, click Add and
select Embedded array. Choose policy_limit
from the Source table drop-down menu and ensure that the
Root path prefix is policyCoverageParts.
Under the All fields checkbox, uncheck the
policyCoverageDetailIdentifier field and click
Save and close.
Repeat the process for policy_deductible.
Embed insurable_object_party_role
Insurable objects have additional relationships to specify the address and roles played by the different parties. To include this information, click Add and select Embedded array. Choose insurable_object_party_role from the Source table drop-down menu.
Under the All fields checkbox, uncheck the
insurableObjectIdentifier field and click
Save and close.
Next Steps
After you map the Policy domain, refactor the Claim domain in a similar manner. See Refactor the Claim Domain.