Skip to content

Commit ed1de87

Browse files
Merge pre-local branch into master for first deploy!
DOCSP-30882 Merge pre-local into master branch
2 parents 7679548 + 8711fe0 commit ed1de87

File tree

188 files changed

+6506
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+6506
-15
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esbonio.sphinx.confDir": ""
3+
}

snooty.toml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,30 @@ title = "Relational Migrator"
44
intersphinx = [ "https://www.mongodb.com/docs/manual/objects.inv",
55
"https://www.mongodb.com/docs/atlas/objects.inv"
66
]
7-
7+
88
# toc_landing_pages = ["/paths/to/pages/that/have/nested/content"]
99

10+
toc_landing_pages = [
11+
"installation",
12+
"installation/install-on-a-single-machine/install-on-a-single-machine",
13+
"installation/install-on-an-unattended-server/install-on-an-unattended-server",
14+
"installation/install-on-an-unattended-server/debian-server-installation/debian-server-installation",
15+
"installation/install-on-an-unattended-server/windows-server-installation/windows-server-installation",
16+
"installation/install-on-an-unattended-server/rhel-centos-server-installation/rhel-centos-server-installation",
17+
"projects/projects",
18+
"mapping-rules/mapping-rules",
19+
"mapping-rules/mapping-rule-options/mapping-rule-options",
20+
"mapping-rules/calculated-fields/calculated-fields",
21+
"mapping-rules/synthetic-foreign-key/synthetic-foreign-keys",
22+
"table-filters/table-filters",
23+
"diagrams/diagrams",
24+
"diagrams/navigate-diagrams/navigate-diagrams",
25+
"diagrams/navigate-diagrams/working-with-entities/working-with-entities",
26+
"jobs/sync-jobs",
27+
"jobs/data-verification/data-verification",
28+
"connection-strings/connection-strings",
29+
"code-generation/code-generation"
30+
]
31+
1032
# [constants]
1133
# constant = "value"
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.. _rm-code-generation:
2+
3+
===============
4+
Code Generation
5+
===============
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
In a migration project, in addition to migrating data, you frequently
14+
update or rewrite parts of your application code. Relational Migrator's
15+
Code Generation feature reduces the time and effort involved in this process.
16+
17+
Relational Migration Code Generation analyzes MongoDB collections and
18+
generates application code from your MongoDB schema.
19+
20+
Code Generation:
21+
22+
* Uses connections defined in your project to connect to MongoDB and generate application code files.
23+
* Provides language support for C#, Java, JavaScript and JSON.
24+
25+
For each collection in your destination MongoDB connection, Code Generation generates code files. These files contain language specific model classes and appropriate library imports to run your application on MongoDB. You can then download or copy these automatically generated files into your application. You may need to make manual updates to the generated code in order to integrate it with your existing application code.
26+
27+
Code Generation Options
28+
-----------------------
29+
30+
Code Generation has the following options:
31+
32+
.. list-table::
33+
:header-rows: 1
34+
35+
* - Option
36+
- Description
37+
* - Language
38+
- The programming language that Relational Migrator generates code files for.
39+
* - Template
40+
- Describes the types of artifacts that are generated in the chosen language.
41+
42+
.. _rm-code-generation-templates:
43+
44+
Code Generation Templates
45+
-------------------------
46+
47+
Code Generation supports the following application templates:
48+
49+
.. list-table::
50+
:header-rows: 1
51+
52+
* - Language
53+
- Template Name
54+
- Description
55+
* - C#
56+
- Persistence Layer
57+
- Includes the POCOs as well as repository classes that use the C# MongoDB Driver.
58+
* - C#
59+
- POCO (Plain Old CLR Object)
60+
- Generates your code as framework independent C# entity classes.
61+
* - Java
62+
- POJO (Plain Old Java Object)
63+
- Generates your code as framework independent Java entity classes.
64+
* - Java
65+
- Spring Data
66+
- Includes the POJOs as well as repository classes built using the Spring Data framework.
67+
* - JavaScript
68+
- Mongoose Schemas
69+
- Generates your code as Mongoose JavaScript schema classes.
70+
* - JavaScript
71+
- Node
72+
- Generates CRUD repository classes for use in a Node.js application.
73+
* - JSON
74+
- JSON Schema (MongoDB)
75+
- Generates JSON Schema files that are able to be used for `MongoDB schema validation <https://www.mongodb.com/docs/manual/core/schema-validation/specify-json-schema/>`__.
76+
* - JSON
77+
- JSON Schema (Standard)
78+
- Generates JSON Schema files that can be used with third party tools.
79+
* - JSON
80+
- Sample documents
81+
- Generates sample JSON documents that align to each collection's schema.
82+
83+
Get Started
84+
-----------
85+
86+
- :ref:`<rm-download-all-code-files>`
87+
- :ref:`<rm-download-single-code-file>`
88+
89+
.. toctree::
90+
:hidden:
91+
:titlesonly:
92+
93+
/code-generation/download-all-code-files
94+
/code-generation/download-single-code-files
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. _rm-download-all-code-files:
2+
3+
=======================
4+
Download All Code Files
5+
=======================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
Code Generation is a feature built into Relational Migrator that helps
14+
automatically generate code files for your applications connected
15+
to MongoDB. This page details how to generate and download all code files into a zip file.
16+
17+
About this Task
18+
---------------
19+
20+
Some templates also generate additional files which are not specific to
21+
a MongoDB collection. These files are called :guilabel:`Support files`.
22+
Click the :guilabel:`Support files` check box to indicate if you would like
23+
these files included in your downloads.
24+
25+
Steps
26+
-----
27+
28+
#. Navigate to the :guilabel:`Code Generation` screen, in the left :guilabel:`Generate code` pane.
29+
#. Select a :guilabel:`Language`.
30+
#. Select a :guilabel:`Template`.
31+
#. Select the MongoDB collections by clicking check box next to the collection name.
32+
#. Click the :guilabel:`Download selected files` button. The selected files download into a zip file
33+
to your :guilabel:`Downloads folder`. The zip file has a naming convention of ``PROJECTNAME-LANGUAGE-TEMPLATE``.
34+
35+
.. image:: /img/code-generation/code-generation-download-all-button.png
36+
:alt: Download All Code Files
37+
38+
Learn More
39+
----------
40+
41+
:ref:`rm-download-single-code-file`
42+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _rm-download-single-code-file:
2+
3+
==========================
4+
Download Single Code Files
5+
==========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
Code Generation is a feature built into Relational Migrator that helps
14+
automatically generate code files for your applications connected
15+
to MongoDB. This page details how to generate and download individual code files.
16+
17+
About this Task
18+
---------------
19+
20+
Some templates also generate additional files which are not specific to
21+
a MongoDB collection. These files are called :guilabel:`Support files`. Click
22+
the :guilabel:`Support files` check box to indicate if you would like these
23+
files included in your downloads.
24+
25+
Steps
26+
-----
27+
28+
You can view, download, or copy a single collections code file.
29+
30+
#. Navigate to the :guilabel:`Code Generation` screen, in the left :guilabel:`Generate code` pane.
31+
#. Select a :guilabel:`Language`.
32+
#. Select a :guilabel:`Template`.
33+
#. Click the MongoDB collection name.
34+
#. A tab displays for each code file. More than one code file per collection may be generated depending on the template.
35+
#. Click the :guilabel:`Copy` or :guilabel:`Download` buttons in the target code file to download or copy that files contents.
36+
37+
.. image:: /img/code-generation/code-generation-copy-download-button.png
38+
:alt: Download Individual Code File
39+
40+
Learn More
41+
----------
42+
43+
:ref:`Download All Code Files <rm-download-all-code-files>`
44+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
==================
2+
Connection Strings
3+
==================
4+
5+
.. contents:: On this page
6+
:local:
7+
:backlinks: none
8+
:depth: 1
9+
:class: singlecol
10+
11+
Relational Migrator uses connection strings to connect to both
12+
the relational and MongoDB databases. You can create connection strings:
13+
14+
- Using the UI when you create a project.
15+
- Using the UI when you create a sync job.
16+
- By manually providing the Uniform Resource Identifier (URI).
17+
18+
Get Started
19+
-----------
20+
21+
- :ref:`rm-relational-database-connection-strings`
22+
- :ref:`rm-mongodb-database-connection-strings`
23+
24+
.. toctree::
25+
:titlesonly:
26+
:hidden:
27+
28+
/connection-strings/mongodb-database-connection-strings
29+
/connection-strings/relational-database-connection-strings
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
.. _rm-mongodb-database-connection-strings:
2+
3+
===================================
4+
MongoDB Database Connection Strings
5+
===================================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
.. include:: /includes/uri-usage-disclaimer.rst
14+
15+
To start a migration job, Relational Migrator must connect to your MongoDB
16+
database. Relational Migrator requires a username and password which has ``readWrite``
17+
access in the target database. This page describes
18+
the procedure to make an authenticated user account and the Uniform Resource
19+
Identifier (URI) formats for defining connections to your target
20+
MongoDB database.
21+
22+
Relational Migrator can use both Atlas and on-premises URIs. This page
23+
provides separate instructions for each deployment type.
24+
25+
Atlas
26+
-----
27+
28+
Connect to Your Deployment
29+
~~~~~~~~~~~~~~~~~~~~~~~~~~
30+
31+
To provision user accounts in Atlas you need to be
32+
`logged in to the Atlas GUI <https://cloud.mongodb.com/v2/>`__.
33+
34+
Create a New User
35+
~~~~~~~~~~~~~~~~~
36+
37+
#. In the :guilabel:`Security` section of the left navigation, click :guilabel:`Database Access`.
38+
#. Click :guilabel:`Add New Database User`.
39+
#. In the :guilabel:`Authentication Method` section of the :guilabel:`Add New Database User` modal window, select the box labeled :guilabel:`Password`.
40+
#. Under :guilabel:`Password Authentication`, enter the username ``migrator-service`` for the new user in the top text field.
41+
#. Enter the password ``password`` for the new user in the lower text field.
42+
#. Under :guilabel:`Database User Privileges`, click :guilabel:`Built-in Role`.
43+
#. Select :guilabel:`Read and write to any database`.
44+
#. Click :guilabel:`Add User`.
45+
46+
Connection URI
47+
~~~~~~~~~~~~~~
48+
49+
Using the previously created account credentials, format the connection
50+
URI for the target database. In this case ``MongoEnterprises``.
51+
52+
.. code-block::
53+
54+
mongodb+srv://migrator-service:[email protected]/MongoEnterprises
55+
56+
On-Premises
57+
-----------
58+
59+
In this example, use ``mongosh`` to provision a user account that
60+
connects to the ``MongoEnterprises`` database.
61+
62+
This examples assume your deployment is running on ``localhost`` and the
63+
default port of ``27017``.
64+
65+
Connect to Your Deployment
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~
67+
68+
When connecting to your deployment, your user account requires the
69+
`createRole <https://www.mongodb.com/docs/manual/reference/method/db.createRole/>`__
70+
permission in both the ``admin`` and ``MongoEnterprises`` databases.
71+
Copy the following code with your admin credentials into a terminal to
72+
connect to your deployment with ``mongosh``.
73+
74+
.. code-block::
75+
76+
mongosh "mongodb://myadminuser:myadminpassword@localhost:27017/admin"
77+
78+
For details on ``mongosh`` connections see :
79+
`Connecting to your MongoDB Deployment <https://www.mongodb.com/docs/mongodb-shell/connect/>`__.
80+
81+
Create a New User
82+
~~~~~~~~~~~~~~~~~
83+
84+
In ``mongosh``, run the following command to create a
85+
user in the ``admin`` database:
86+
87+
.. code-block::
88+
89+
use admin
90+
91+
db.createUser(
92+
{ user: "migrator-service",
93+
pwd: "password",
94+
roles:[{role: "readWrite" , db:"MongoEnterprises"}]
95+
}
96+
)
97+
98+
Create the same user in the user in the ``MongoEnterprises`` database:
99+
100+
.. code-block::
101+
102+
use MongoEnterprises
103+
db.createUser(
104+
{ user: "migrator-service",
105+
pwd: "password",
106+
roles:[{role: "readWrite" , db:"MongoEnterprises"}]
107+
}
108+
)
109+
110+
These commands:
111+
112+
- Create a new user ``migrator-service`` with the password ``password``
113+
in the ``admin`` and ``MongoEnterprises`` databases.
114+
- Apply the ``readWrite`` system role to the ``MongoEnterprises``
115+
database for the user ``migrator-service``.
116+
117+
Connection URI
118+
~~~~~~~~~~~~~~
119+
120+
Using the previously created account credentials, format the connection
121+
URI for the target database. In this case ``MongoEnterprises``.
122+
123+
.. code-block::
124+
125+
mongodb://migrator-service:password@localhost:27017/MongoEnterprises
126+
127+
Results
128+
-------
129+
130+
The MongoDB connection URI is optionally specified as part of the process for
131+
creating a Relational Migrator project or when creating a sync job.

0 commit comments

Comments
 (0)