MongoDB
Configuring your MongoDB destination.
Prerequisites
- If your MongoDB security posture requires IP whitelisting, have the data syncing service's static IP available during the following steps. It will be required in Step 3.
Network allowlistingCloud Hosted (US):
35.192.85.117/32Cloud Hosted (EU):
104.199.49.149/32If private-cloud or self-hosted, contact support for the static egress IP.
Step 1: Locate connection information
MongoDB CLI
- Connect to your MongoDB node using the MongoDB CLI as an admin.
- Execute the following query:
db.adminCommand( { replSetGetStatus : 1 } ).members- Make a note of the host identifiers.
MongoDB Atlas
- Log in to your Atlas dashboard, click into the Database tab and click Connect.
- Under Connect your application, click into the Drivers option.
- In the following screen, make a note of the host identifier within your connection string. It can be found within the string that starts with
mongodb+srvand the identifier is the URI after the@. E.g.,some-cluster.some-characters.mongodb.net.
Step 2: Allow database access
See CLI or Atlas instructions below depending on your MongoDB deployment type.
MongoDB CLI
- Connect to your MongoDB node using the MongoDB CLI as an admin.
- Execute the following script (with a
usernameandpassword) to create a new user. Replacedatabasewith the name of the database you'd like to load data into.
use admin
db.createUser({
user: "<username>",
pwd: "<password>",
roles: [ {role: "readWrite", db: "<database>"} ]
})MongoDB Atlas
- Log in to your Atlas dashboard, click into the Database Access section of the Security options.
- Select Add New Database User. Choose the Password authentication method, and enter a
usernameandpasswordfor the new user. - In the Database User Privileges menu, select Grant Specific User Privileges. Within Specific Privileges, add the following:
readWrite@<database>(with the name of the database you'd like to load data into). You can leave the Collection field blank (*). - Click Add User to create the new user.
Step 3: Setting up Network Access
If your MongoDB instance enforces IP Access restrictions, you'll need to allow access to a static IP.
For self-hosted MongoDB deploymentsIP allowlisting should be configured at the network or firewall level (e.g., using cloud provider security groups,
iptables, or other firewall tools). Please consult your network administrator or your hosting provider's documentation.
MongoDB Atlas CLI
If you manage your Atlas project with the Atlas CLI, execute the following command to add the static IP to your project's IP access list. You may need to append /32 to the IP address to specify it in CIDR notation.
atlas accessLists create "<static_ip_address>/32" --comment "data sharing service static IP"MongoDB Atlas
- Log in to your Atlas dashboard, click into the Network Access section of the Security options.
- Select Add IP Address. In Access List Entry enter the static IP of the service.
- Add an optional comment (e.g., "data sharing service") and click Confirm.
Step 4: Add your destination
Use the host name, port (unless using Atlas, in which case is not needed), and database name (as noted in Step 1) and the username and password (as configured in Step 2) to complete the connection.
Permissions checklist
- Network:
- Inbound rule allows TCP connections from the static egress IP
- MongoDB:
readWriteon the target databaseatlas accessLists create(if using Atlas CLI for IP allowlisting)
FAQ
Q: How is the MongoDB connection secured?
A: The connection uses a dedicated MongoDB user with readWrite role scoped to the target database. Network access can be restricted to the static egress IP.
Updated about 19 hours ago