Installing MongoDB Compass

Downloading and installing the free MongoDB Compass app, which provides an easy-to-use interface for interacting with databases on MongoDB.

Learning Goals

At the end of this Tutorial, you will be able to:

  • Download the free MongoDB Compass app to your local machine.
  • Connect MongoDB Compass to your MongoDB Atlas account using the provided connection string.
  • Installing the VS Code extension for MongoDB Atlas.

About MongoDB Compass

Compass is a free interactive tool for querying, optimizing, and analyzing your MongoDB data. Compass provides features such as schema visualization, sophisticated querying abilities, real-time performance metrics, and aggregation pipelines.

screenshot

Compass is available for Windows, Mac, and Linux.

Installing MongoDB Compass

There are three versions of Compass: a full version with all features, a read-only version, and an isolated edition. You will want to install the full version. Follow the steps below:

  1. Go to the Compass Downloads page on the MongoDB website.
  2. Download the appropriate version for your machine.
  3. Follow the installation instructions.

Once installed, Compass launches and prompts you to configure privacy settings and specify update preferences.

Connecting Compass to MongoDB Atlas

After installing and launching Compass on your local machine, follow these steps to connect it to your account on MongoDB Atlas:

  1. When you launch Compass, you will see a screen similar to the following. screenshot
  2. In the URI field, paste in your connection string and click the Save & Connect button. screenshot You obtained your connection string in a previous Tutorial.
  3. Next, you are prompted to give a Name and Color to your saved connection. screenshot When finished, click the Save & Connect button.
  4. You are now shown a screen that lists in the left the MongoDB Altas databases you have access to. screenshot If this is your first time using Compass, you will see only the sample databases provided for you to experiment with.

If you click on any of the sample databases, you will see a screen similar to the following. This lists the collections in the selected database and a range of options for working with them.

screenshot

Installing the VS Code extension for MongoDB Atlas

Microsoft Visual Studio Code offers a helpful extension for working with MongoDB. Follow these steps to install and connect it:

  1. In VS Code, in the Activity Bar, click the Extensions icon.
  2. In the Extensions list displayed, type mongodb. screenshot
  3. Install the extension.

Your next task is to connect the extension to your MongoDB Atlas account. Here are the steps:

  1. In the Activity Bar, click the MongoDB icon. screenshot
  2. Click the + icon to Add MongoDB Connection.
  3. In the Connect with Connection String box, click the Connect button.
  4. In the input area at the top of the screen, paste in your connection string and press ENTER.

If your connection is successful, the MongoDB extension pane will look similar to the following.

screenshot