The MongoDB connector
You can use this connector both for source and target endpoints.
Source endpoint
-
Select Connection settings → Connection type:
-
Under Hosts, click + Host and specify IP-address or the domain name (FQDN) the of a host to connect to.
-
Specify the Replica set for the connection.
-
Provide the Port to use for connections. You can change the default port number if necessary.
-
Under CA Certificate, click Upload a file to provide a certificate file (public key) in PEM format.
-
-
Specify the database attributes:
-
Authentication source – a database name associated with user and password below.
-
Username – a user of the database for connection to Transfer service.
-
Password – a password of the database user.
-
-
Under Collection filter:
-
Included collections. The Transfer service will transfer only the data from these collections.
-
Excluded collections. The data from the collections on this list won't be transferred.
-
To create a MongoDB source endpoint with API, use the endpoint.MongoSource model.
MongoDB type | Transfer type |
---|---|
— | [int64](*int64) |
— | [int32](*int32) |
— | [int16](*int16) |
— | [int8](*int8) |
— | [uint64](*uint64) |
— | [uint32](*uint32) |
— | [uint16](*uint16) |
— | [uint8](*uint8) |
— | [float](*float) |
— | [double](*double) |
— | [string](*string) |
bson |
[utf8](*utf8) |
— | [boolean](*bool) |
— | [date](*date) |
— | [datetime](*datetime) |
— | [timestamp](*timestamp) |
bson |
any |
Target endpoint
-
Under Connection settings → Connection type:
-
Click + Host name. In the input field, provide the FQDN of the host containing your MongoDB database.
-
In the Replica set field, specify the mongod
-
Specify the Port number (by default,
27018
for non-sharded clusters and27017
for sharded ones). -
Click Choose a file to provide a CA certificate. In the File upload dialog, select a Method:
Upload-
Click Choose a file.
-
Find your
.pem
certificate and click Open.
Text-
Open your
.pem
certificate in a text editor. -
Copy all the text from the opened file and paste it into the Content field.
-
-
Click Submit. You'll see the
Data loaded
status message:
-
-
Specify the database attributes:
-
Authentication source is the MongoDB database name associated with the username and password below.
-
Username for connection to the MongoDB database.
-
Password for the database user.
-
Database name is the name of the database to which you want to transfer your data.
Warning
If you don't specify a database name, the collections will be created in databases with the same names as on the source.
If the field isn't empty, all data will be placed in the specified database.
-
Cleanup policy. This policy allows you to select a way to clean up data in the target database when you activate, reactivate or reload the transfer:
-
Disabled
: Do not clean. Select this option if you only perform replication without copying data. -
Drop
: Fully delete the collections included in the transfer (default). Use this option to always transfer the latest version of the schema to the target database from the source. -
Truncate
: Execute the remove()
-
-
The completed from should look as follows:
To create a MongoDB target endpoint with API, use the endpoint.MongoTarget model.
Transfer type | MongoDB type |
---|---|
int64 | bson |
int32 | bson |
int16 | bson |
int8 | bson |
uint64 | bson |
uint32 | bson |
uint16 | bson |
uint8bson |
|
float | bson |
double | bson |
string | bson |
utf8 | bson |
boolean | bson |
date | bson |
datetime | bson |
timestamp | bson |
any | bson |