Fields
On this page
You can customize fields when adding or editing your mapping rules. Relational Migrator allows you to define custom fields using Calculated Fields, define custom IDs using Customize ID Fields, or convert your source relational column data types into a supported BSON data type.
Use Cases
You can use field customization to:
Include or exclude fields in your mapping rules.
Change field names.
Embed child fields in parent documents with dotted paths. For details, see embedding fields.
Customize
_id
fields using JavaScript expressions.Customize a field using JavaScript expressions.
Configure null handling behavior.
Behavior
The fields section contains a list of fields derived from columns in the relational table. Mapping rules include each column by default. To exclude a field from your sync job, uncheck the box. The field name initially matches the column name (with the global casing applied). To modify the name, edit the text box. You can click the icon next to each field to reveal additional options.
Relational Migrator assigns a default data type to your MongoDB fields that most closely matches the source column data type.
You can use the BSON Type drop-down menu to change the MongoDB field data type to a different data type to fine-tune your schema. If the chosen type is not compatible with the source values, each field converted results in an error during the sync job. Sync jobs continue until the user-defined maximum error threshold is reached.
To embed child fields in a parent document, rename the field in the form
parent.child
. For example, renaming the fieldproductName
toproduct.name
results in a child document,name
, embedded within the parent document,product
. Any additional fields with the sameproduct.
prefix are also embedded as children.Change a source relational datatype to a specific MongoDB BSON datatype.
Supported data types for converted fields include:
Boolean
Date
Decimal
Double
Integer
Long
String
For details, see conversion examples.
Use Null Handling to specify the behavior of
Null
values. You can omit these values or include them in your destination collections.You can view a field's Original name and Original type. These values correspond to the relational columns from which the field originates.
Note
For calculated fields, the BSON type is initially shown as Default, which means the field type is automatically selected at runtime. You can choose an explicit BSON type for a calculated field and your sync job converts the type as part of the process.