Docs Menu
Docs Home
/
Relational Migrator

Data Modeling

On this page

  • MongoDB Schema Design Patterns
  • Details
  • Relationships
  • Default Rules
  • Data Type Detection
  • Mapping Direction Preference
  • Row Mapping Options
  • Custom Fields and Filters
  • Manually Add Synthetic Foreign Keys
  • Preview Mapping Rules
  • Learn More

To model your data in Relational Migrator, design a MongoDB schema and create mapping rules. Mapping rules specify how relational table columns are mapped to MongoDB documents. You can create mapping rules in a project after you have provided a valid relational database connection string and credentials.

Schema design patterns in MongoDB shape how your data is organized. Good schema design practices ensure efficient storage, retrieval, and manipulation of your data. These design decisions can improve the performance and scalability of your MongoDB deployment. Relational Migrator allows you to make key schema design decisions such as combining multiple tables into a single collection or embedding data in your documents.

For an overview of schema design best practices, review the following documentation:

  • Data Model Examples and Patterns.

  • Building with Patterns.

  • Summary of Schema Design Anti-Patterns and How to Spot Them.

Mapping rules help define a one-to-one, one-to-many, or many-to-many relationship between your tables and collections.

You can define mapping rules for the following configurations:

  • A single table that maps to a single MongoDB collection.

  • A single table that maps to multiple MongoDB collections.

  • Multiple tables that map into a single collection.

Relational Migrator automatically creates a New Documents mapping rule for each source table. This initial rule produces a MongoDB schema that is identical to the relational database. You can edit the initial rule before running any data migration jobs.

Relational Migrator automatically selects the best MongoDB data type for each source column.

For example, SQL Server source data of types text, varchar, nvarchar or char become the MongoDB string data type.

You can create a mapping rule based on a source relational model or based on a destination MongoDB model.

You can modify your MongoDB model as you create mapping rules, but Relational Migrator treats your relational model as static and unchanging. If your relational database schema changes, you must refresh the relational model. For more information, see Manage the Relational Model.

You can define mapping rules with the following Migrate as options:

Option
Behavior

Translates each relational database row to a new document.

Translates each row into an array element within a parent document identified by a foreign key relationship.

Translates each row as a set of fields or an embedded object in a child document identified by a foreign key relationship.

You can create mapping rules with custom fields. Relational Migrator also supports table filters to limit data migrated from relational tables.

If your database does not have foreign key constraints, you can manually add foreign keys as synthetic foreign keys. All foreign keys are translated to MongoDB document references when Relational Migrator transforms your source relational data into MongoDB collections. For more information, see Synthetic Foreign Keys.

You can preview how mapping rules affect your data model by viewing the blue dotted box in the MongoDB diagram pane. This allows you to preview the mapping rule before you apply it.

  • If the collection entity doesn't exist, it is added to the diagram with a preview state around the entire card.

  • If the collection entity already exists, the embedded mappings are added to the card with a preview state around the new fields.

Preview Mapping Options

Back

Project Settings