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 suc­cess­ful NoSQL solutions. The database man­age­ment system spe­cial­ises in the storage and man­age­ment of extensive data records, which can be processed in various formats and sum­mar­ised as BSON documents in col­lec­tions. 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 analyse 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 situ­ations.

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 in­di­vidu­al documents, col­lec­tions 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, col­lec­tions and documents
  • Display the data that you have stored in your database
  • Add, edit and delete documents
  • Analyse your system and the databases you have created in depth
  • Check the per­form­ance of your system con­tinu­ously
  • Monitor and adapt data in ac­cord­ance with JSON format prin­ciples

MongoDB Compass is free to use.

Managed Databases
Time-saving database services
  • En­ter­prise-grade ar­chi­tec­ture managed by experts
  • Flexible solutions tailored to your re­quire­ments
  • Hosted in the UK under strict data pro­tec­tion le­gis­la­tion

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 in­de­pend­ently of the network.

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

What re­quire­ments are there?

MongoDB Compass is com­pat­ible 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 com­pre­hens­ive MongoDB tutorial. You also need to have ad­min­is­trat­or rights.

Although the in­stall­a­tion 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 in­stall­a­tion 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 suc­cess­fully completed the in­stall­a­tion, 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 con­nec­tion with the server

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

  1. Click on New Con­nec­tion at the top left.
  2. Toward the top is the option Fill in con­nec­tion fields in­di­vidu­ally. 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 ad­di­tion­al security measures, switch to User Name / Password under Au­then­tic­a­tion 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 ad­di­tion­al 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 col­lec­tion 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 col­lec­tion. 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 col­lec­tions. We show you how to create more complex queries in our article on creating MongoDB queries.

5c41c3ae604d2b5c45104261627abf24

08f52149459ff4a0108e2571f8eb081d

89cf7c75c197cea57cfa3e6a72579e21

14863eebdbf6cec4464b9ae379a347d4

8d77efbe135ecf4b07e3ec4b7476f216

Go to Main Menu