MongoDB Atlas connection
Step 1 - Configure connection method
Before retrieving your connection string, ensure your MongoDB Atlas instance is accessible to Data Integration. For more information, refer to selecting connection methods such as Private networking, SSH tunnel, reverse SSH tunnel, and VPN.
Connecting to Mongo Atlas using private endpoint (optional)
Using Private Endpoint for connecting to Mongo Atlas is accessible to users on the Enterprise plan.
-
Under Database Network, select Private Endpoint and click Add Private Endpoint.
-
On Cloud Provider, Select AWS and click Next.
-
Choose Region.
Data Integration supports PrivateLink in the next regions:On console.rivery.io:
- us-east-1
- us-east-2
- us-west-2
On eu-west-1.console.rivery.io:
eu-west-1On il-central-1.console.rivery.io:
il-central-1On ap-southeast-2.console.rivery.io:
ap-southeast-2Wait until the endpoint is available and a green check mark icon is displayed.
-
Copy the command, and obtain the
--service-namevalue. -
Provide the
service-nameto your Data Integration Account Manager or to the Support team. Data Integration internally connects with your Mongo Atlas Private Endpoint, and provides you a VPC-Endpoint-ID in the format:vpce-XXXXXXXXXXXXXXX -
Enter the VPC Endpoint ID and click Create.
Step 2 - Retrieving a connection string
- In the MongoDB Atlas account, go to Databases, select your database, and click Connect.
- Select Private Endpoint as the connection method, and select the Private Endpoint you have created.
- Select Connect your application.
- Copy the URL shown on the page, and paste it.
And change the
<username>and<password>to{username}and{password}, and change the MyFirstDatabase to the database name you want to connect to.
Formatting MongoDB connection strings: When connecting to MongoDB Atlas clusters, ensure the connection string includes the +srv prefix. This prefix enables the use of Domain Name System (DNS) Service (SRV) records for cluster discovery and connection configuration.
- Incorrect:
mongodb://shilohrajk:hxbTHdLfPZKAVR2v@cluster0.ksugj.mongodb.net:27017/sample_mflix
- Correct:
mongodb+srv://shilohrajk:hxbTHdLfPZKAVR2v@cluster0.ksugj.mongodb.net/sample_mflix
Using the +srv format prevents DNS-related and authentication issues, ensuring a reliable connection to your MongoDB Atlas cluster.
Step 3 - Setting up the connection at the Data Integration console
- Enter the Connection Name.
- Configure the Host, Port (default: 27017), and Database.
The database name must be in lowercase.
- Enter your Username and Password.
- Specify your URI.
- Click Test Connection to verify your credentials.
- Click Save to save your connection.