How to install and use MongoDB Compass

MongoDB Compass makes working with MongoDB even easier. Here we show you how to install and use the graphical user interface.

How MongoDB Compass helps you manage databases

MongoDB is one of the most popular and successful NoSQL solutions. The database management system specializes in the storage and management of extensive data records, which can be processed in various formats and summarized as BSON documents in collections. Although the solution strives to be as user-friendly as possible, working with command lines still requires some technical knowledge and a great deal of accuracy.

MongoDB Compass provides a clear graphical user interface that you can view, edit and analyze your data with. Here we explain how to install MongoDB Compass on your system and go over the extensive features the tool offers users for everyday situations.

What can MongoDB Compass do?

MongoDB Compass can do everything that the shell can do. However, thanks to the user-friendly interface, many tasks are much quicker and easier to complete. Access extends to individual documents, collections and even the creation of complete databases. Below we’ve listed just a few of the things you can do with MongoDB Compass:

  • Create new databases, collections and documents
  • Display the data that you have stored in your database
  • Add, edit and delete documents
  • Analyze your system and the databases you have created in depth
  • Check the performance of your system continuously
  • Monitor and adapt data in accordance with JSON format principles

MongoDB Compass is free to use.

Managed Databases
Time-saving database services
  • Enterprise-grade architecture managed by experts
  • Flexible solutions tailored to your requirements
  • Leading security in ISO-certified data centers

What different versions of MongoDB Compass are there?

Before you can install MongoDB Compass, you must first decide which version of the tool you want to use:

  • MongoDB Compass is the complete version.
  • MongoDB Compass Read-Only does not offer options for editing or deleting documents.
  • MongoDB Compass Isolated works independently of the network.

All three versions are available for download on the MongoDB website.

What requirements are there?

MongoDB Compass is compatible with commonly used operating systems. You can obtain the graphical user interface (GUI) for OS X, Ubuntu and Windows, among others.

In order to use the tool, you need to have the document-oriented database already installed. You can find out how this works in our comprehensive MongoDB tutorial. You also need to have administrator rights.

Although the installation steps may differ slightly depending on the system, working with MongoDB Compass is the same on all computers.

How to install MongoDB Compass

If you are using OS X or Windows, simply go to the MongoDB website mentioned above and select the version for your operating system. Download it and then follow the prompts from the installation wizard. If you want to install MongoDB Compass on Ubuntu, you’ll need sudo rights. If you have these, continue with the steps below:

  1. Go to the MongoDB Compass website and copy the download link for the version you want to use.
  2. Use the wget command. For version 1.39.4 it looks like this:
wget https://downloads.mongodb.com/compass/mongodb-compass_1.39.4_amd64.deb
bash
  1. Use the apt command to install MongoDB Compass:
sudo apt install ./mongodb-compass_1.39.4_amd64.deb
bash
  1. Once you have successfully completed the installation, open MongoDB Compass:
$ mongodb-compass
bash

The first thing you’ll see is a home screen. In the follow sections, we’ll explain what to do next.

Establish a connection with the server

To be able to use MongoDB Compass, you first need to establish a connection to your server. The easiest way to do this is by following the steps below:

  1. Click on New Connection at the top left.
  2. Toward the top is the option Fill in connection fields individually. Click on it.
  3. Now enter the IP of your remote server in the Hostname field.
  4. If you have not already changed the port manually, you can work with the default value here. This is “27017”.
  5. If you would like to use additional security measures, switch to User Name / Password under Authentication and then enter the login data that you normally use for MongoDB.
  6. Once you have completed the steps, MongoDB Compass will connect to your server. You’ll then see an overview of your database(s) on the right.

How to create a database with MongoDB Compass

If you have not yet created a database or would like to create an additional one, you can easily do it with MongoDB Compass. To create a database, follow these steps:

  1. First click on the CREATE DATABASE button at the top. This opens a pop-up window.
  2. Now give your new database a name.
  3. Give your collection a title.
  4. Once you are happy with all the entries, click on CREATE DATABASE at the bottom right.

Add or create documents

In addition to saving your data in BSON documents with MongoDB Compass, you can also create and insert new documents in the GUI. Just follow the steps below:

  1. On the left-hand side, click on the database you want to add or create documents in.
  2. Now select the collection. A new window will open.
  3. Under Add Data, you have the option of importing an existing document (Import File) or creating a new document (Insert Document).
  • If you would like to add an existing document, click on Import File, select the file and specify the format. Then click on IMPORT.
  • A new window will open if you select Insert Document. You can add values in JSON format or key-value pairs in this window. Once you have edited the document, click on INSERT.

How to view, edit or delete documents in MongoDB Compass

You can also view, edit or delete documents in MongoDB Compass.

View documents

MongoDB Compass offers three different views for viewing the contents of a document:

  • in list form
  • in the JSON overview
  • as a table

Simply select the option you want in the top bar, and you’ll find it next to VIEW.

Note

To be able to edit and delete documents, you need the full version or the isolated version of MongoDB Compass. You can’t edit or delete documents in the read-only version.

Edit documents

If you want to edit a document, do the following:

  1. Open the document you want to edit.
  2. Click on the pencil icon in the top right-hand corner.
  3. Now select the area you want to change.
  4. When you are finished, click UPDATE.

Delete documents

It’s also easy to delete a document in MongoDB Compass:

  1. Open the document you want to delete.
  2. Make sure that you really no longer need the document.
  3. Click on the recycle bin icon at the top right to delete it.
Tip

MongoDB Compass offers a simple search function (query bar) for queries in specific collections. We show you how to create more complex queries in our article on creating MongoDB queries.

Was this article helpful?
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.
Page top