Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/
Relational Migrator
/

Example: Insurance Data Models

This sample tutorial uses the Relational Migrator to transform a 21-table insurance data schema into a simple five-collection MongoDB model.

In the sample data set, all people, organizations, and groups are represented as Parties, which can be related to other major objects with specified roles. The Party design also provides a common approach for describing communication identifiers, relationships between parties, and legal identifiers.

In this tutorial, you will use the Relational Migrator to port the Object Management Group’s Party Role model from a relational structure to MongoDB’s document model. Specifically, you will refactor the Party model in the context of the Policy, Claim, and Litigation domains.

This example requires the following applications:

  • MongoDB Relational Migrator version 1.4.3 or higher. To download the latest version, see the MongoDB Relational Migrator release page.

  • MongoDB Atlas: Ensure you have access to an Atlas cluster with write permissions to create the new database to where you will migrate the data.

  • PostgreSQL version 16 or higher: Ensure you have access to a PostgreSQL database server instance with permissions to create a new database and user. The instance can be in the cloud, on-prem, or on your local machine. In addition to PostgreSQL, install the following PostgreSQL Client Applications:

    • psql: a command-line application that allows you to interactively type in queries, issue them to PostgreSQL, and see the query results.

    • pg_restore: A command-line application that restores the PostgreSQL database from the sample archive file.

Additionally, download the mongodb_insurance_model.tar sample archive file. This file contains all the tables, relationships, and sample data from the Party Role model in a tabular format.

To replicate the Party Role model in PostgreSQL, follow the following steps:

1
psql -h <host> -p <port> -U <user> -d <database>

If you have a newly installed local instance with default parameters, use 127.0.0.1 as your host, 5432 as your port, postgres as your database, and type whoami in your terminal for a default username.

2
CREATE DATABASE mongodb_insurance_model;
3
CREATE USER istadmin WITH PASSWORD '<password>';
ALTER DATABASE mongodb_insurance_model OWNER TO istadmin;

Ensure that you replace <password> with a strong password of your choice.

4

Navigate to the folder where you downloaded the archive file's backup of the database and run the following command to load the data:

pg_restore -h <host> -p <port> -U <user> -d mongodb_insurance_model mongodb_insurance_model.tar
5
psql -h <host> -p <port> -U <user> -d mongodb_insurance_model -c "SELECT * FROM pg_catalog.pg_tables WHERE schemaname='omg';"

You should see a list of 21 tables similar to the following image:

List of 21 tables in the Party Role model

The example tutorial consists of the following steps:

1

Connect your PostgreSQL database to Relational Migrator. See Connect to Relational Migrator.

2

Refactor the Party domain in the MongoDB view of Relational Migrator. See Refactor the Party Domain.

3

Refactor the Policy domain in the MongoDB view of Relational Migrator. See Refactor the Policy Domain.

4

Refactor the Claim domain in the MongoDB view of Relational Migrator. See Refactor the Claim Domain.

5

Refactor the Litigation domain in the MongoDB view of Relational Migrator. See Refactor the Litigation Domain.

6

Migrate your data to your MongoDB instance by using the Relational Migrator. See Migrate Your Data to MongoDB.

Back

Delete

On this page