Connecting to MongoDB Cluster

Once you've created a new MongoDB cluster through the ScaleGrid console, you must connect it to your deployment. Follow these steps to connect your MongoDB cluster:

Prerequisites

Network Connectivity

📘

Network connection works

Skip to the next step if you've already configured your network settings

Ensure that your network settings allow the client machine to connect to port 27017 on instances of the MongoDB cluster by setting up the following:

  • If your cluster is open to the Internet, ensure that your client is whitelisted either under the Cluster Firewall Settings or under the Account Firewall Settings on the ScaleGrid console. Whether your cluster is open to the Internet or not depends on the Cloud Profile settings.
  • If you cluster is NOT open to the Internet, then the network settings need to be determined from the VPC and Security Group settings of the cloud provider themselves. Refer to the documentation of your cloud provider to find out the correct configuration required to ensure connectivity.

MongoDB User

In order to connect to your MongoDB cluster, you must first create a new user, as it is highly recommended that you do not use the admin user that was created with your cluster. Follow these steps to create a new user for your MongoDB cluster:

Connecting to Your MongoDB Database

There are various ways to connect to your MongoDB database, click on the one you wish to proceed with: