Sync Document data from MongoDB to marketing, sales and other business applications
Overview
Hightouch lets you query data from collections and views stored in MongoDB and push it to downstream destinations. Most of the setup occurs in the Hightouch UI, but you need access to your MongoDB instance for information like your host, port, protocol, and credentials.
Make sure to allowlist Hightouch IP addresses so Hightouch can reach your cluster. Refer to our IP address docs to find the relevant IP addresses for your Hightouch region. If you are using Atlas, you can add allowlist IP addresses from Security > Network Access.
Retrieve MongoDB credentials
The user whose credentials you use must have readAnyDatabase
permission for Hightouch to correctly query your MongoDB collections. To create a user in MongoDB, use db.createUser()
.
Atlas
If you are using MongoDB Atlas, follow these instructions to retrieve your credentials:
-
Go to your cluster dashboard and click Connect.
-
Choose Connect your application.
-
Copy the hostname, username and connection options.
Community and Enterprise versions
Use the hostname, username and password you use to connect to your MongoDB cluster. For more information, refer to the MongoDB documentation.
Connection configuration
To get started in Higtouch, go to the Sources overview page and click the Add source button. Select MongoDB and follow the steps below.
Choose connection type
Hightouch can connect directly to MongoDB over the public internet or via an SSH tunnel. Since data is encrypted in transit via TLS, a direct connection is suitable for most use cases. You may need to set up a tunnel if your MongoDB instance is on a private network or virtual private cloud (VPC).

Hightouch supports both standard and reverse SSH tunnels. To learn more about SSH tunneling, refer to Hightouch's tunneling documentation.
Configure your source
Enter the following required fields into Hightouch:
- Host: The hostname or IP address of your MongoDB server.
- Protocol: Hightouch supports standard or SRV protocol to connect to your cluster. If you are using MongoDB Atlas and the connection string begins with protocol
mongodb+srv
, choose the SRV protocol to connect. - Port: The port number of your PostgreSQL server. The default port number is 27017, but yours may be different. You don't need to specify the port if you are using SRV protocol, as Hightouch uses the SRV record to look up hostname and port.
- Username: This can be your personal MongoDB login or a dedicated user for Hightouch.
- Password: This is the password for the user specified above.
- (Optional)Connection options: You can specify connection options when connecting to your cluster. Use the format
name=value
, with each parameter separated by an ampersand&
. For example,retryWrites=true&connectTimeoutMS=30000
. See MongoDB's docs for a list of parameters.
Test your connection
When setting up MongoDB as a source for the first time, Hightouch checks that you have the correct permissions. Once the test passes, click Continue to finish setup.
Next steps
Once your source configuration has passed the necessary validation, your source setup is complete. Next, you can set up models to define which data you want to pull from MongoDB.
Model setup
- In Hightouch, go to the Models overview page.
- Click Add model.
- Select the MongoDB source you previously created.
- Select the Database that contains the table you want to sync.
- Select the Collection/View you want to sync.
- Optionally, enter a Filter to apply to your query.
- Preview your model's query results.
- Click Continue.
- Name your model and select its primary key. Hightouch uses the primary key to determine which rows have been added, changed, or removed since the last sync.
Collections and views
For advanced use cases, like joining data across collections or running aggregation pipelines, you can leverage views to pre-define the pipeline. After creating a view, it automatically appears in the dropdown. If you want to create a view that only contains certain columns from your collection, you can use the project operator.
Filters
Refer to the MongoDB Query documents documentation to learn how to use filters.
For example, to query all the documents with an account_id
equal to 20
, you can set this filter: { "account_id": 20 }
.
Tips and troubleshooting
To date, our customers haven't experienced any errors while using this source. If you run into any issues, please don't hesitate to . We're here to help.