Open In App

Connect MongoDB Atlas Cluster to MongoDB Compass

Last Updated : 27 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

MongoDB Compass is a free GUI for MongoDB. We might want to connect MongoDB Atlas Cluster to MongoDB Compass to take benefit of the GUI model for database administration. By connecting MongoDB Atlas, the fully managed cloud database service, to MongoDB Compass, developers can easily interact with their cloud-based MongoDB databases without relying on the command line

This guide explains how to connect MongoDB Atlas Cluster to MongoDB Compass. The connection process involves obtaining a connection string from MongoDB Atlas, configuring MongoDB Compass settings, and establishing a connection for efficient database management.

Why Connect MongoDB Atlas to MongoDB Compass?

Connecting MongoDB Atlas to MongoDB Compass allows developers to take advantage of MongoDB's graphical user interface (GUI) for efficient database administration, offering several benefits:

  • Visual Database Management: Manage your data, collections, and databases with an intuitive interface.
  • Ease of Use: No need for complex command-line operations; everything is accessible via the GUI.
  • Real-time Data Exploration: Query, update, and visualize your MongoDB data effortlessly.

Steps to Connect MongoDB Atlas Cluster to MongoDB Compass

Follow the steps mentioned below to connect the MongoDB Atlas cluster to the MongoDB Compass:

Step 1: Install MongoDB Compass

Before establishing a connection to MongoDB Atlas, we need to have MongoDB Compass installed on our machine. Follow these steps:

1. Download MongoDB Compass:

  • Go to the official site of MongoDB compass and click the download now button.
mongodb compass website
MongoDB compass Interface
  • Go to the MongoDB Compass Download (GUI) section and select the version, operating system, and click the download button. The exe file will be downloaded automatically.
mongodb compass download section
MongoDB GUI version download section
mongodb version and package
MongoDB version and package

2. Install MongoDB Compass:

Once downloaded then install the MongoDB compass. Search and execute the downloaded exe and the MongoDB compass will be installed automatically.

Step 2: Login/Signup to MongoDB Atlas Account

  • Go to the official MongoDB Atlas site and create a new account if we have otherwise logged in to your account.
  • Click the try free button. We will reach the signup/login page if not logged into your account.
mongodb_atlas_interface
MongoDB Atlas dashboard
atlas_signup
Atlas SignUp

After logging in, you’ll be redirected to the MongoDB Atlas Dashboard, where you can manage clusters, databases, and users.

atlas_database_dashboard
MongoDB Atlas database dashboard

Step 3: Creating the MongoDB Atlas Cluster

  • Select the database option from the left sidebar and we will see the option below "Create a database". If we already have a database created then we will see details of the cluster in which the dataset is created.
  • Assuming we don't have a database so first we have to create a cluster and inside the cluster, we will have our databases.
  • Atlas cluster is nothing but reserving some space on cloud services like AWS and Google Cloud to store the information of the datasets that we will create. The cluster configuration is according to the user's access location and frequent usage or that the paid services are provided. 

As a beginner, we will use the free services. Let's create a cluster by clicking the option "create a database".

mongodb_cluster_creation
MongoDB Atlas cluster creation

The list of services, regions, and providers (AWS, Google Cloud, Azure) will be displayed. If a large number of users access your database then you can go either higher computing or storage services but for now, we will use free service. 

Select the M0 free and then click on Create to create a free cluster. Next step you have to complete the Captcha. After that you will be redirected to the database dashboard and the new cluster will be created.

cluster_configuration
cluster configuration settings

Next, go to the security section in the left sidebar and there you will find the option to create a user for the database you will create. This user will have read and write operations and the permissions also can be changed. Ensure the username and password are not the same as the Atlas account password.

database_user
database username/password setting

Step 4: Copy the Cluster Connection String

  • Again go to the database section and you will find the details about the cluster that you have created. Now we will connect this with the MongoDB compass.
  • Click the connect button, the right side of the cluster name Cluster0.
cluster_created
Cluster Details

Next, a window will open. Click on the Drivers option.

connection_1
Cluster connection, connect option details

Choose the appropriate driver (point 1) and copy the connection string (point 3).

connection_copy_string
Connection string

Step 5: Open MongoDB Compass and Paste the Connection String

With MongoDB Compass installed and the connection string copied, it's time to connect to your MongoDB Atlas cluster.

  • Start the MongoDB Compass and we will see the dashboard like the below.
mongodb_connection_string
MongoDB Compass connection dashboard

Step 6: Connect to Your Cluster

Next, paste the copied connection string into the new connection String field, replace the password with the actual database user password that you have created in step 3, and then click connect.

password_modification
password modification

After that, you will be connected to your MongoDB Atlas. You can create or modify a database through MongoDB Compass Dashboard.

mongodb_dashboard
MongoDB compass dashbopard after Atlas connection

Conclusion

In conclusion, utilizing MongoDB Compass and integrating it with the MongoDB Atlas dashboard will simplify database interaction. Without the need for complicated command-line procedures, users can create, update, and query data in databases with ease when using a graphical user interface (GUI). Having MongoDB Compass connected to the MongoDB Atlas dashboard improves database administration in general. By following the simple steps outlined above, you can quickly set up MongoDB Atlas and MongoDB Compass to enhance your database management experience.


Next Article

Similar Reads