Discover your data with MongoDB Compass

  • Compass indexes
  • Compass indexes
  • Compass explain plan
  • Compass documents
  • Compass schema
  • Compass connection
  • Compass databases list

Do you know the new MongoDB tool which lets you analyze your data, the structure of your collections in a visual manner without having to write down commands? Its name is Compass and it is available for you now!


I am going to describe how to use it and its principal functionalities, with this aim I have downloaded, and imported in my test database, the following json file: restaurants.json


Compass connection

Let’s go, when we open MongoDB Compass we see a light window asking us to introduce the necessary data for making the connection to our MongoDB instance:

  • Hostname
  • Port
  • Authentication
  • SSL

At the same time we can assign a name to the connection.

In a column at the left of the window, there is a list of our favorite connections and also the more recent ones. This allows us a faster connection without filling in the form.

When the form is filled in we click the CONNECT button and the access is very fast.


The first information we can see is:

  • Host and Port we are connected to
  • MongoDB version
  • The number of our databases
  • The total number of our collections
  • A button for refreshing all this information

Just below we have a search box, useful when we have a large number of databases and/or collections.

Finally, there is a list of our databases and collections alphabetically ordered.

Compass databases list

MongoDB make a fast analysis of the collections when clicking over it, showing the next information:

  • Number of documents
  • Total size of the collection
  • Average size of documents
  • Number of indexes
  • Total indexes size
  • Average size of the indexes

As we can see, we already have the fundamental data about the collection.


The information is divided in the next topics:

  • Schema
  • Documents
  • Explain Plan
  • Indexes

We have a text box where, if necessary, we can write a query for analyzing the data we are interested in through the APPLY button. If we want to go back to the first full data analysis we can use the RESET button.

One of the most powerful characteristics of this tool is that we can use it whitout the need of write any command, we can use it only with the mouse. By the way, we can always view how Compass automatically constructs the query for us when we select a range of our data. This allows the use of the tool by those people without knowledge of the MongoDB query syntax.


Compass schema

The number of documents returned by the query is the first information we obtain. If this is greater than 1.000 (in my case) the report will be constructed with 1.000 documents randomly selected.

We already have the information related to all of the collection’s fields, with its data type, or types. Also, we have the percentage of each data type of the field. If the field has embedded fields we can see them clicking on it.

At the right of each field we have very useful graphics describing the data stored in it, even geographycal coordinates. With the mouse we can select/limit the range of data we want to make the report. We can see how the query is built automatically as we limit the range. Also, we can see information of the data simply moving the mouse over the graphic.


Compass documents

In this section we can explore the documents returned by the query. Of course, also the embedded fields.


Compass explain plan

Here it is the information related to indexes, even if one of them have been used by the query planner:

  • Keys examined
  • Docs examined
  • Docs returned
  • Query time
  • Sort in memory
  • And also, the information of the query planner, with the winning and rejected plans, execution statistics and even about the host.


Compass indexesIn this section we can consult the indexes built in our collection with the next characteristics:

  • Name, fields and direction
  • Type (simple, compound, text, etc)
  • Size
  • How many times has been used
  • Properties (unique, ttl, etc)

I think this is a very useful tool for developers, for DBA’s, for newbies and also for experts. Everybody will get the most of it making tasks in a fast way and with zero commands at the shell. MongoDB will add new characteristics soon.

I would like to remind you that we have available the possibility of improve the MongoDB Compass tool through the next menus:

  • Help Improve Compass
  • Provide Feedback

Thank you very much for reading, I wish you have enjoyed Compass and you will use it.

Juan Roy

MongoDB Fan & Financial Software Developer

You may also like...

Leave a Reply