Docs Menu
Docs Home
/
Relational Migrator
/ /

New Documents

On this page

  • About this Task
  • Steps
  • Example
  • Learn More

Use this mapping rule when you want data from a table to be stored in a dedicated collection. Any database table can use a New Documents mapping rule.

The New Documents mapping rule is the most basic mapping rule option. It creates a document for each row of data in your relational database.

  • You can have multiple New Documents mapping rules from different tables into the same collection.

  • Relational Migrator treats these tables as isolated data and the destination documents are not merged together in any way.

1
  1. In the left Schema model pane, click on a collection under the MongoDB or Relational header.

    This prompts the Mappings pane to open on the right of the screen.

2
  1. From the Mapping screen, click + Add to create a new mapping rule or click the icon to edit an existing rule.

  2. Select New documents under Migrate table as.

3

Allows you to explicitly include rows where an expression returns true. This differs from Table Filters, which filter based on an SQL query, and apply to all rows from a particular table. Mapping rule filters only apply to a specific mapping.

  1. On the Mappings pane, click the icon next to Advanced settings.

  2. Select the Add mapping rule filter icon.

  3. Enter a valid JavaScript filter expression in the Value expression text box.

4
  1. Define the options for the new mapping rule. When defining the mapping rule options, you can:

    • Change the collection name.

      To change the collection name, click the Name text box and enter the new name. Click outside of the text box to save the change. If the name is already in use, you receive a validation error.

    • Add Calculated Fields to create new fields based on relational source columns. See Calculated Fields for more information.

    • Change field names.

    • Include or exclude a field from your sync job by clicking the icon next to the field name.

5
  1. Click Save And Close.

This section demonstrates the relational input and the MongoDB output of the New Documents mapping rule.

In this example a New Documents mapping rule is applied to a single row from the Customer table.

Click the tabs below to see the input and output for this example:

Customer table:

Id
Name
Address1
Address2
Address3
1
Joelynn Fawthrop
86 Dwight Pass
Carregal
3800-854

The document in the Customer collection now has all the relation table fields.

{
"_id": { "CustomerID": 1 },
"Name": "Joelynn Fawthrop",
"Address1": "86 Dwight Pass",
"Address2": "Carregal",
"Address3": "3800-854"
}

Back

Rule Options