Skip to content

Commit 980405f

Browse files
authored
Merge pull request #49 from ianf-mongodb/DOCSP-32370
DOCSP-32370 Add Field Customization Content
2 parents 045101a + 1710654 commit 980405f

17 files changed

+526
-22
lines changed

config/redirects

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
define: prefix docs/relational-migrator
2-
define: base https://www.mongodb.com/docs/
1+
define: prefix relational-migrator
2+
define: base https://www.mongodb.com/docs
33
define: versions master
44

55
# raw: <source file> -> ${base}/<destination>
66

7+
# Redirect calculated fields to new drawer introduced in DOCSP-32370 - Field Customizations
8+
# Field Customizations begin
9+
[*]: ${prefix}/mapping-rules/calculated-fields/calculated-fields -> ${base}/relational-migrator/mapping-rules/fields/calculated-fields/calculated-fields/
10+
[*]: ${prefix}/mapping-rules/calculated-fields/calculated-fields/add-calculated-fields -> ${base}/relational-migrator/mapping-rules/fields/calculated-fields/calculated-fields/add-calculated-fields
11+
[*]: ${prefix}/mapping-rules/calculated-fields/calculated-fields/view-calculated-fields -> ${base}/relational-migrator/mapping-rules/fields/calculated-fields/calculated-fields/view-calculated-fields
12+
[*]: ${prefix}/mapping-rules/calculated-fields/calculated-fields/edit-calculated-fields -> ${base}/relational-migrator/mapping-rules/fields/calculated-fields/calculated-fields/edit-calculated-fields
13+
[*]: ${prefix}/mapping-rules/calculated-fields/calculated-fields/delete-calculated-fields -> ${base}/relational-migrator/mapping-rules/fields/calculated-fields/calculated-fields/delete-calculated-fields
14+
# Field Customizations end

snooty.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ toc_landing_pages = [
1919
"projects/projects",
2020
"mapping-rules/mapping-rules",
2121
"mapping-rules/mapping-rule-options/mapping-rule-options",
22-
"mapping-rules/calculated-fields/calculated-fields",
22+
"mapping-rules/fields/calculated-fields/calculated-fields",
23+
"mapping-rules/fields/field-customizations",
2324
"mapping-rules/synthetic-foreign-key/synthetic-foreign-keys",
2425
"table-filters/table-filters",
2526
"diagrams/diagrams",
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When defining :ref:`rm-calculated-fields` and :ref:`rm-id-field-customizations`,
2+
Relational Migrator shows an initial data type of :guilabel:`default`.
3+
When you run a sync job, Relational Migrator updates this data type.

source/mapping-rules/edit-rules.txt

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,57 @@ effect the next time a sync job is run.
1818
About this Task
1919
---------------
2020

21-
Options available on the ``edit`` pane depend on the type of
21+
Options available on the :guilabel:`edit` pane depend on the type of
2222
mapping rule you are editing. For an overview of each mapping rule
23-
option see:
23+
option, see:
2424

2525
- :ref:`New Documents <rm-new-documents>`
26-
26+
2727
- :ref:`Embedded Array <rm-embedded-array>`
2828

2929
- :ref:`Embedded Documents <rm-embedded-documents>`
3030

3131
Steps
3232
-----
3333

34-
1. Open a project.
34+
#. From the :guilabel:`Mapping` screen, click a table or collection name
35+
on the :guilabel:`Schema model` pane or :guilabel:`Diagram` view.
36+
37+
#. From the :guilabel:`Mappings` pane,
38+
click the :icon-fa5:`pencil-alt` icon.
39+
40+
#. Define the options for the mapping rule. When defining the
41+
mapping rule, you can:
42+
43+
- Change the collection name.
44+
- Change field names.
45+
- Include or exclude a field from your sync job by clicking the
46+
:icon-fa5:`check-square` icon next to the field name.
47+
48+
#. Optionally, if you want to select a BSON type or set null handling
49+
rules for your mapping rule:
50+
51+
I. Click the :icon-fa5:`chevron-left` icon next to the field
52+
you want to customize.
53+
54+
II. Select a :guilabel:`BSON type`.
55+
56+
III. Select a :guilabel:`Null handling` option.
57+
58+
- :guilabel:`Insert as null`: preserves null values, and nulls
59+
are inserted into your destination collection.
60+
- :guilabel:`Omit`: skips any null values, and nulls are not
61+
inserted into the destination collection.
3562

36-
#. Click the ``Pencil`` icon to open the ``Edit mapping`` pane.
63+
You can view a field's :guilabel:`Original name` and
64+
:guilabel:`Original type` in the expanded customized field menu.
3765

38-
#. Edit the mapping rule.
66+
.. note::
3967

40-
.. image:: /img/mapping-rules/mapping-rule-edit-overview-2.png
41-
:figwidth: 450 px
42-
:alt: Mapping Rule Edit Overview
68+
For additional details on field customization and data type conversions,
69+
see :ref:`field customizations <rm-field-customizations>`.
4370

44-
#. Click ``Save and close`` button to save your edits.
71+
#. Click :guilabel:`Save and close` to save your edits.
4572

4673
Learn More
4774
----------

source/mapping-rules/calculated-fields/add-calculated-fields.txt renamed to source/mapping-rules/fields/calculated-fields/add-calculated-fields.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ About this Task
3434
Calculated field expressions access values from the current source
3535
database row using the syntax ``columns["<COLUMN_NAME>"]``.
3636

37+
.. include:: /includes/fact-calculated-fields-type.rst
38+
3739
Steps
3840
-----
3941

4042
#. From the :guilabel:`Mapping` screen, click a table or collection name
41-
on the :guilabel:`schema model` pane or diagram view.
43+
on the :guilabel:`Schema model` pane or diagram view.
4244

4345
#. Add a new mapping rule or edit an existing mapping rule.
4446

@@ -57,6 +59,8 @@ Steps
5759

5860
The new field is visible in MongoDB after your next sync job runs.
5961

62+
.. _calculated-field-examples:
63+
6064
Examples
6165
--------
6266

source/mapping-rules/calculated-fields/calculated-fields.txt renamed to source/mapping-rules/fields/calculated-fields/calculated-fields.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ Get Started
6060
:titlesonly:
6161
:hidden:
6262

63-
/mapping-rules/calculated-fields/add-calculated-fields
64-
/mapping-rules/calculated-fields/view-calculated-fields
65-
/mapping-rules/calculated-fields/edit-calculated-fields
66-
/mapping-rules/calculated-fields/delete-calculated-fields
63+
/mapping-rules/fields/calculated-fields/add-calculated-fields
64+
/mapping-rules/fields/calculated-fields/view-calculated-fields
65+
/mapping-rules/fields/calculated-fields/edit-calculated-fields
66+
/mapping-rules/fields/calculated-fields/delete-calculated-fields
67+
/mapping-rules/fields/calculated-fields/customized-id-fields
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. _rm-id-field-customizations:
2+
3+
====================
4+
Customize ID Fields
5+
====================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
You can customize an ``_id`` field as part of your sync job.
14+
Customized ``_id`` fields allow you to change a field's BSON data type
15+
and write custom JavaScript expressions instead of using a project's
16+
:ref:`Key Handling Option <rm-key-handling-setting>`.
17+
Customized ``_id`` fields **must** evaluate to a unique value.
18+
19+
About this Task
20+
---------------
21+
22+
- You may want to use customized ``_id`` fields to make your ``_id`` field
23+
more expressive. For example, you can concatenate multiple fields to form
24+
a unique ``_id``.
25+
26+
- You can revert the custom ID changes at any time. The ``_id`` field
27+
returns to the project's :ref:`Key Handling Option <rm-key-handling-setting>`.
28+
29+
Steps
30+
-----
31+
32+
#. From the :guilabel:`Mapping` screen, click a table or collection name
33+
on the :guilabel:`Schema model` pane or diagram view.
34+
35+
#. From the :guilabel:`Schema model` pane,
36+
click the :icon-fa5:`pencil-alt` icon next to a mapping rule.
37+
38+
#. Click the :icon-fa5:`ellipsis-v` icon next to the :guilabel:`_id` field
39+
and select :guilabel:`Transform to calculated field`.
40+
41+
#. (Optional) Select a :guilabel:`BSON type`.
42+
43+
#. (Optional) Select a :guilabel:`Null handling` option.
44+
45+
- :guilabel:`Omit`: Null values are not inserted into your
46+
destination collection.
47+
- :guilabel:`Insert as null`: Null values are inserted into the destination
48+
collection.
49+
50+
#. Enter a valid JavaScript expression. For examples, see
51+
:ref:`valid JavaScript expressions<calculated-field-examples>`.
52+
53+
#. Click :guilabel:`Done` and then click :guilabel:`Save and close`.
54+
55+
56+
Learn More
57+
----------
58+
59+
- :ref:`rm-add-calculated-fields`
60+
- :ref:`rm-edit-calculated-fields`
61+
- :ref:`rm-view-calculated-fields`

source/mapping-rules/calculated-fields/view-calculated-fields.txt renamed to source/mapping-rules/fields/calculated-fields/view-calculated-fields.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Steps
2828
-----
2929

3030
#. From the :guilabel:`Mapping` screen, click a table or collection name on the
31-
:guilabel:`schema model` pane or diagram view.
31+
:guilabel:`Schema model` pane or diagram view.
3232

3333
#. Click the pencil icon next to the mapping rule you want to view.
3434

0 commit comments

Comments
 (0)