MongoDB Compass: An Overview
Tags: mongodb, compass, nosql
Published: 2017-04-11 13:57:07

---
title: "MongoDB Compass: An Overview"
published: true
description: Some feature highlights of MongoDB Compass
cover_image: 
tags: MongoDB, Compass, NoSQL
---

When I first started using computers, everything was done through the command line. Everything. Apple had yet to come out with the Macintosh, Windows was not even a glimmer in the eye of Microsoft. For that matterÂ Microsoft wasn't a glimmer yet. Everyone got used to living in the shell and knowing a multitude of commands, arguments, and syntax to achieve even the smallest of tasks. Along came the graphical user interface (GUI) both in terms of operating systems and a variety of tools. Many of these tools providedÂ much of the functionality that could be achieved in the command line, certainly the majority of the most common tasks were included in an easier to use and visualize format.

This is the case for [MongoDB](http://www.mongodb.com)'s [Compass](https://www.mongodb.com/products/compass) product. Since it's original release in December of 2015 several versions and upgrades have been added and as of this writing we are now on version 1.6. Like many GUI tools it aims to offer an easier interface for accomplishing many tasks one might otherwise do in theÂ [mongo shell](https://docs.mongodb.com/manual/reference/mongo-shell/).Â In this post, I'd like to take a look at some of the more useful features that Compass provides for managing your MongoDB [databases and collections](https://docs.mongodb.com/manual/reference/glossary/).

One of the great features of MongoDB is that it has a flexible [data model](https://docs.mongodb.com/manual/data-modeling/). This is a powerful feature for schema design. However, from the shell it can pose limitations on knowing the exact makeup of a collection's schema. Compass provides a visual interface which [samples](https://docs.mongodb.com/compass/master/faq/#compass-faq-sampling) a subset of the data in a collection and analyzes the documents from within this subset.

![Data Visualization in MongoDB Compass](https://thepracticaldev.s3.amazonaws.com/i/gcfb9za2h08iycnt3o2v.PNG)

This provides an easy to see snapshot of how the collection is designed in an easy to use GUI fashion. One gets immediate information on types, ranges, and frequency of fields in a collection, and can then easily choose, sort, and query the collection based on the data presented in the schema visualization. The same results can certainly be obtained with shell commands, but the time and effort involved to get there is much greater.

This feature alone in Compass makes it worth the download, but there is much more! Creating and dropping databases and collections is possible in Compass and, as I pointed out in a previous post on [indexing](https://www.kenwalger.com/blog/nosql/mongodb/indexing-in-mongodb/)Â MongoDB collections, [indexes](https://docs.mongodb.com/manual/indexes/) can have a huge impact on the performance of queries.Â Compass not only provides an intuitive interface for index creation, it provides detailed feedback about the performance of a query and what and how many steps and time MongoDB had to go through to return the documents.

![Index Creation Modal](https://thepracticaldev.s3.amazonaws.com/i/x1s16zntpf86yvogeyl6.PNG)

![Explain Plan with an Index](https://thepracticaldev.s3.amazonaws.com/i/qanlir32akf77tkmtnmj.PNG)

Once again, all of thisÂ <em>can</em> be done in the shell right? We can create an index in the shell with <code>db.collection.createIndex()</code> and we can get [explain](https://docs.mongodb.com/manual/reference/explain-results/) results in the shell as well. I might argue though that the creation of indexes in Compass is easier withÂ manyÂ of the various index creation nuances during the creation step. Further, being able to see the results of the explain plan visually is of benefit, of course you can also see the raw [JSON](http://www.json.org/) as well for a more in depth look at the results.

The last of the features that I want to discuss in this post is the ability to get insights into some of the operational aspects of the database itself. Compass provides a GUI interface for [server performance](https://docs.mongodb.com/compass/master/performance/) for the metrics of Operations, Read &amp; Write, Network, and Memory usage. It also provides information on the Hottest Collections, meaning the collections with the most activities as well as information on slow running queries (potential candidates for indexes here). All the information can be obtained from the command line using various tools that come with MongoDB, such as [mongostat](https://docs.mongodb.com/manual/reference/program/mongostat/#bin.mongostat) and [mongotop](https://docs.mongodb.com/manual/reference/program/mongotop/#bin.mongotop), and the [profiler](https://docs.mongodb.com/manual/tutorial/manage-the-database-profiler/?_ga=1.209304209.2079735664.1483559375) for slow queries. Once again, the GUI interface provided by Compass provides, in my opinion, an easier way to grasp what is going on with the MongoDB Server.

I realize that not all functionality of managing and maintaining a MongoDB database server and associated collections is possible with Compass. There are still tasks that currently still require using the command line... heck, I still wind up using the command line to perform tasks in Windows and OS and how long have those products had a GUI interface? HoweverÂ for a product that has only been out for less than a year and a half, this is a great start.

Compass has a lot more features that I didn't cover here, I would encourage you to [download](https://www.mongodb.com/download-center?filter=enterprise#compass)Â it for your Windows, OS X, or Linux system and discover a new way to visualize your MongoDB data and graphically manage your system.