Skip to Content

MongoDB Prerequisites

Introduction

These are the prerequisites for using the MongoDB connector with a MongoDB cluster and database:

All prerequisite tasks will require you to log in to your MongoDB account:

MongoDB Atlas Configuration 0

Create a MongoDB Cluster and Cluster Credentials

Follow these steps to create a MongoDB cluster to be used with the MongoDB connector:

  1. Click Databases on the left sidebar menu and click Build a Database:

    MongoDB Atlas Configuration 1

  2. Choose the cluster type that best fits your needs and select a Cloud Provider & Region:

    MongoDB Atlas Configuration 2

  3. Scroll down the page to verify or change the default values for Cluster Tier, Additional Settings, and Cluster Name. Click the Create Cluster button to start the cluster creation process:

    MongoDB Atlas Configuration 3

  4. When the cluster is available, the Security Quickstart view will be displayed where you will set up access to your cluster:

    MongoDB Atlas Configuration 4

    1. The How would you like to authenticate your connection? section is where you will set the Username and Password for a new admin on your cluster. Certificate authentication is not supported.

    2. When complete, click the Create User button.

    Important

    Username and Password are used in the configuration of a MongoDB connector connection to connect to your cluster and database.

    MongoDB Atlas Configuration 5

    1. The Where would you would like to connect from? section is where you will set up allowlist information so that the MongoDB connector can access your cluster and database from Harmony.

    2. Keep My Local Environment selected and add the Harmony Cloud Agent IP addresses that correspond to your region or the IP addresses of your Private Agents.

    When both sections are complete, click the Finish and Close button.

    Note

    Settings defined in the Security Quickstart view can be changed later in Database Access and Network Access under Security in the left sidebar menu.

  5. A dialog box will display indicating that configuration is complete. Click Go to Databases to continue to the next step of configuration:

    MongoDB Atlas Configuration 6

Create a MongoDB Database and Collection

Follow these steps to create a MongoDB database associated with an existing cluster to be used with the MongoDB connector:

  1. Click Databases on the left sidebar menu to view your clusters. Click the Browse Collections button associated with the specific cluster you'd like to set up a database in.

    MongoDB Atlas Configuration 7

  2. The view will have you choose between two options: Load a Sample Dataset and Add My Own Data:

    MongoDB Atlas Configuration 8

    • Load a Sample Dataset: If you choose to load the sample dataset, sample data will be loaded into the cluster.

    • Add My Own Data: If you choose to add your own data, a dialog box will open to allow specifying the Database and Collection names:

      MongoDB Atlas Configuration 9

      You can then load data either by using the tools in MongoDB Atlas or later by using the MongoDB connector after configuring its connection.

    Important

    Both Load a Sample Dataset and Add My Own Data will create a database and collection in the cluster. A database and collection are required to use the MongoDB connector, and are specified during the configuration of a MongoDB connection and its activities, respectively.

Allowlist Agent IP Addresses

Note

If you followed Create a MongoDB Cluster and Cluster Credentials and added the necessary IPs in the Security Quickstart, you can skip this prerequisite task.

Follow these steps to add Harmony Agent IP addresses to your existing MongoDB cluster's allowlist:

  1. Click Network Access on the left sidebar menu to view your clusters. Click the Add IP Addresses button to begin adding IPs to the allowlist:

    MongoDB Atlas Configuration 13

  2. A dialog box will display prompting you to add an IP Access List Entry. After one is specified, click Confirm to add more:

    MongoDB Atlas Configuration 14

Allowlist Cloud Agents

If using a Cloud Agent Group, add the Harmony Cloud Agent IP addresses that correspond to your region.

Allowlist Private Agents

If using Private Agents, add the IP addresses associated with them.

Obtain Hostname Information

Follow these steps to obtain the hostname required for the Host field in the MongoDB connector connection:

  1. Click Databases on the left sidebar menu to view your clusters. Click the Connect button associated with the specific cluster you'd like to connect to:

    MongoDB Atlas Configuration 10

  2. A dialog box will display with connection options for your chosen cluster. Under Choose a connection method, click Connect your application:

    MongoDB Atlas Configuration 11

  3. A connection string will display under Add your connection string into your application code. The hostname is found between @ and /?:

    MongoDB Atlas Configuration 12

    The hostname in this example is cluster0.r7ss3rz.mongodb.net.

Note

See MongoDB's documentation on MongoDB Atlas for additional information.