Search documentation...

ChangelogBook a demoSign up


Sync Document data from MongoDB to marketing, sales and other business applications


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().


If you are using MongoDB Atlas, follow these instructions to retrieve your credentials:

  1. Go to your cluster dashboard and click Connect.

    MongoDB Connect

  2. Choose Connect your application.

    MongoDB Connect Options

  3. Copy the hostname, username and connection options.

    MongoDB Connect URL

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).

Direct connection vs. SSH tunnel

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

  1. In Hightouch, go to the Models overview page.
  2. Click Add model.
  3. Select the MongoDB source you previously created.
  4. Select the Database that contains the table you want to sync.
  5. Select the Collection/View you want to sync.
  6. Optionally, enter a Filter to apply to your query.
  7. Preview your model's query results.
  8. Click Continue.
  9. 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.


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.

Ready to get started?

Jump right in or a book a demo. Your first destination is always free.

Book a demoSign upBook a demo

Need help?

Our team is relentlessly focused on your success. Don't hesitate to reach out!

Feature requests?

We'd love to hear your suggestions for integrations and other features.

Last updated: Jul 25, 2023

On this page

OverviewRetrieve MongoDB credentialsAtlasCommunity and Enterprise versionsConnection configurationChoose connection typeConfigure your sourceTest your connectionNext stepsModel setupTips and troubleshooting

Was this page helpful?