New Documents
On this page
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.
About this Task
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.
Steps
(Optional) Configure mapping rule filters
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.
On the Mappings pane, click the icon next to Advanced settings.
Select the Add mapping rule filter icon.
Enter a valid JavaScript filter expression in the Value expression text box.
Configure fields
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 migration job by clicking the icon next to the field name.
Example
This section demonstrates the relational input and the MongoDB output of the New Documents mapping rule.
New Documents
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" }