Skip to content

Commit 0715725

Browse files
DOCSP-30635 Mapping Rules migration (#24)
* DOCSP-30635 delete edit view * DOCSP-30635 delete edit view * DOCSP-30635 delete fix ref * DOCSP-30635 rule relational mongodb * DOCSP-30635 rule mongodb suggested * DOCSP-30635 sfk * DOCSP-30635 schema mapping * DOCSP-30635 toc tree * DOCSP-30635 nit fix * DOCSP-30635 feedback updates * DOCSP-30635 fix ref build error * DOCSP-30635 fix ref build error * DOCSP-30635 mapping rules * DOCSP-30635 title fix
1 parent c2a1545 commit 0715725

13 files changed

+681
-14
lines changed

snooty.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ toc_landing_pages = [
1818
"mapping-rules/mapping-rules",
1919
"mapping-rules/mapping-rule-options/mapping-rule-options",
2020
"mapping-rules/calculated-fields/calculated-fields",
21+
"mapping-rules/synthetic-foreign-key/synthetic-foreign-keys",
2122
"table-filters/table-filters",
2223
"diagrams/diagrams",
2324
"diagrams/navigate-diagrams/navigate-diagrams",
@@ -29,4 +30,4 @@ toc_landing_pages = [
2930
]
3031

3132
# [constants]
32-
# constant = "value"
33+
# constant = "value"

source/mapping-rules/delete-rules.txt

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
.. _delete-rules:
2+
13
============
24
Delete Rules
3-
============
5+
============
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
Deleting a mapping rule removes the mapping rule from your project.
16+
Deleting a mapping rule does not remove existing collections from your
17+
MongoDB cluster.
18+
19+
To remove a collection from your cluster:
20+
21+
- Delete the mapping rule in Relational Migrator. This avoids the collection
22+
being recreated by the next sync job.
23+
24+
- Manually delete the MongoDB collection. This removes the collection from your
25+
cluster.
26+
27+
About this Task
28+
---------------
29+
30+
Deleting a parent mapping rule also deletes any child mapping rules.
31+
32+
For example, if you delete a :guilabel:`New Documents` rule that defines a
33+
collection and a :guilabel:`Array in Parent` rule for the same collection, the
34+
:guilabel:`Array in Parent` rule is also deleted.
35+
36+
Steps
37+
-----
38+
39+
1. Open a project.
40+
41+
#. In the left :guilabel:`Schema model` pane, click the table or collection
42+
for the mapping you want to delete.
43+
44+
This prompts the :guilabel:`Mappings` pane to open on the right of the screen.
45+
46+
#. On the :guilabel:`Mappings` pane, click the :guilabel:`Trash Can` icon.
47+
48+
#. Click :guilabel:`Delete` to confirm.
49+
50+
Learn More
51+
----------
52+
53+
- :ref:`Create Rules From Relational <create-rule-relational>`
54+
55+
- :ref:`Create Rules To MongoDB <create-rule-mongodb>`
56+
57+
- :ref:`View mapping rules <view-rules>`
58+
59+
- :ref:`Edit mapping rules <mapping-rules-edit>`

source/mapping-rules/edit-rules.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,55 @@
33
==========
44
Edit Rules
55
==========
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
You can update a mapping rule after it is created. Edited mapping rules take
16+
effect the next time a sync job is run.
17+
18+
About this Task
19+
---------------
20+
21+
Options available on the ``edit`` pane depend on the type of
22+
mapping rule you are editing. For an overview of each mapping rule
23+
option see:
24+
25+
- :ref:`New Documents <rm-new-documents>`
26+
27+
- :ref:`Embedded Array <rm-embedded-array>`
28+
29+
- :ref:`Embedded Documents <rm-embedded-documents>`
30+
31+
Steps
32+
-----
33+
34+
1. Open a project.
35+
36+
#. Click the ``Pencil`` icon to open the ``Edit mapping`` pane.
37+
38+
#. Edit the mapping rule.
39+
40+
.. image:: /img/mapping-rules/mapping-rule-edit-overview-2.png
41+
:figwidth: 450 px
42+
:alt: Mapping Rule Edit Overview
43+
44+
#. Click ``Save and close`` button to save your edits.
45+
46+
Learn More
47+
----------
48+
49+
To learn more about managing mapping rules, see:
50+
51+
- :ref:`Create Rules From Relational <create-rule-relational>`
52+
53+
- :ref:`Create Rules To MongoDB <create-rule-mongodb>`
54+
55+
- :ref:`Delete mapping rules <delete-rules>`
56+
57+
- :ref:`View mapping rules <view-rules>`

source/mapping-rules/mapping-rules.txt

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,79 @@
44
Mapping Rules
55
=============
66

7+
.. default-domain:: mongodb
78

9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
814

15+
A mapping rule specifies where data from each relational table should be
16+
migrated to and how the columns should be mapped to fields in
17+
MongoDB documents. Mapping rules are created inside a project after you have provided a
18+
valid :ref:`relational database connection string and credentials <rm-relational-database-connection-strings>`.
19+
20+
Mapping Direction Preference
21+
----------------------------
22+
23+
The source relational model is static and unchanging while the target MongoDB model
24+
is dynamic and customizable.
25+
26+
You can create a mapping rule based on a source :ref:`relational model <create-rule-relational>`
27+
or based on a destination :ref:`MongoDB model <create-rule-mongodb>`.
28+
29+
Relationships
30+
-------------
31+
32+
Mapping rules help define a ``one-to-one``, ``one-to-many``, or ``many-to-many``
33+
relationship between your tables and collections.
34+
35+
You can define mapping rules for the following configurations:
36+
37+
- A single table that maps to a single MongoDB collection.
38+
39+
- A single table that maps to multiple MongoDB collections.
40+
41+
- Multiple tables that map into a single collection.
42+
43+
Default Rules
44+
-------------
45+
46+
Relational Migrator automatically creates a :ref:`New Documents mapping rule <rm-new-documents>`
47+
for each source table. This initial rule produces a MongoDB schema that
48+
is identical to the relational database. You can edit the initial rule
49+
before running any data migration jobs.
50+
51+
Data Type Detection
52+
-------------------
53+
54+
Relational Migrator automatically selects the best MongoDB data type for each
55+
source column.
56+
57+
For example, SQL Server source data of types ``text``, ``varchar``,
58+
``nvarchar`` or ``char`` will become the MongoDB ``string`` data type.
59+
60+
Migrate as Options
61+
------------------
62+
63+
Mapping rules can be defined with the following ``Migrate as`` options:
64+
65+
.. list-table::
66+
:header-rows: 1
67+
68+
* - Option
69+
- Behavior
70+
71+
* - :ref:`Migrate rows as New Documents <rm-new-documents>`
72+
- Translates each relational database row to a new document.
73+
74+
* - :ref:`Migrate rows as Embedded array <rm-embedded-array>`
75+
- Translates each row into an array element within a parent document identified by a foreign key
76+
relationship.
77+
78+
* - :ref:`Migrate rows as Embedded documents <rm-embedded-documents>`
79+
- Translates each row as a set of fields or an embedded object in a child document identified by a foreign key relationship.
980

1081
.. toctree::
1182
:titlesonly:
@@ -20,4 +91,4 @@ Mapping Rules
2091
/mapping-rules/delete-rules
2192
/mapping-rules/mapping-rule-options/mapping-rule-options
2293
/mapping-rules/calculated-fields/calculated-fields
23-
/mapping-rules/synthetic-foreign-keys
94+
/mapping-rules/synthetic-foreign-key/synthetic-foreign-keys
Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
.. _create-rule-relational:
22

3-
===========================
4-
Create Rule From Relational
5-
===========================
3+
============================
4+
Create Rules From Relational
5+
============================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
Creating mapping rules is how you translate your relational tables into
16+
MongoDB collections. You can create mapping rules from either the
17+
:guilabel:`Relational` or :guilabel:`MongoDB` headers of the schema model pane.
18+
19+
About this Task
20+
---------------
21+
22+
Options available on the :guilabel:`Add mapping` pane depend on the type of
23+
mapping rule you are adding. For a full overview of each mapping rule
24+
option see:
25+
26+
- :ref:`New Documents <rm-new-documents>`
27+
28+
- :ref:`Embedded Array <rm-embedded-array>`
29+
30+
- :ref:`Embedded documents <rm-embedded-documents>`
31+
32+
You can also create mapping rules based on a destination MongoDB model. For more
33+
information, see :ref:`Create Rules to MongoDB <create-rule-mongodb>`.
34+
35+
Steps
36+
-----
37+
38+
1. Open a project.
39+
40+
#. In the left :guilabel:`Schema model` pane, click on a collection under the
41+
:guilabel:`MongoDB` header.
42+
43+
This prompts the :guilabel:`Mappings` pane to open on the right of the screen.
44+
45+
#. On the :guilabel:`Mappings` pane, click :guilabel:`+ Add` to create a new mapping rule.
46+
47+
#. Define the name of the target MongoDB collection.
48+
49+
#. Define the options for the new mapping rule.
50+
51+
#. Click :guilabel:`Save and close`.
52+
53+
Learn More
54+
----------
55+
56+
To learn more about managing mapping rules, see:
57+
58+
- :ref:`Edit mapping rules <mapping-rules-edit>`
59+
60+
- :ref:`Delete mapping rules <delete-rules>`
61+
62+
- :ref:`View mapping rules <view-rules>`

source/mapping-rules/new-rules-suggested-mappings.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,76 @@
33
====================================
44
Create Rules From Suggested Mappings
55
====================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
Relational Migrator can automatically suggest mapping rules based upon
16+
your relational schema. Using suggested mappings can help you develop
17+
your MongoDB data model faster.
18+
19+
About this Task
20+
---------------
21+
22+
In the :guilabel:`Mappings` pane, you have the option to either apply all the suggested
23+
mapping rules, choose specific suggestions individually, or ignore all of the
24+
suggested mapping rules. The :guilabel:`Suggested mappings` button remains visible,
25+
allowing you to modify your selection at a later point.
26+
27+
Before you Begin
28+
----------------
29+
30+
- You need to enable :guilabel:`Suggested mappings` from the :guilabel:`Project Settings`.
31+
If you created a project with a recommended schema, the suggested mappings
32+
feature is disabled by default.
33+
34+
- In order for Relational Migrator to generate suggested mappings for a specific
35+
table, you need to create a :ref:`New Documents <rm-new-documents>`
36+
mapping rule that maps the table to a collection. You can then select that
37+
collection to see the suggested mapping rules.
38+
39+
Steps
40+
-----
41+
42+
1. On the :guilabel:`Mapping` screen, click one of the following:
43+
44+
- A MongoDB collection on the :guilabel:`Schema model` pane.
45+
46+
- A collection on the MongoDB side of the project diagram.
47+
48+
#. On the :guilabel:`Mappings` pane on the right-hand side of the screen, click
49+
the :guilabel:`Suggested mappings` button.
50+
51+
The suggested mapping rules are generated from your relational schema.
52+
53+
.. note::
54+
55+
The suggested mapping rules display with a blue rectangle in the MongoDB diagram.
56+
These mapping rules are not added to your project until you click the
57+
:guilabel:`Apply` button.
58+
59+
#. Deselect the suggested mapping rules you do not want applied to your MongoDB schema.
60+
61+
#. Click the green :guilabel:`Apply` button at the bottom of the :guilabel:`Mappings`
62+
pane.
63+
64+
The suggested mapping rules are added to your project.
65+
66+
Next Steps
67+
----------
68+
69+
- :ref:`Create a Sync job <rm-create-jobs>`
70+
71+
Learn More
72+
----------
73+
74+
You can also manually create your mapping rules:
75+
76+
- :ref:`Create Rules From Relational <create-rule-relational>`
77+
78+
- :ref:`Create Rules To MongoDB <create-rule-mongodb>`

0 commit comments

Comments
 (0)