MongoDB Compass: An Overview

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‘s Compass product. Since it’s original release in December of 2015 several versions and upgrades have been added. 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. 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.

MongoDB Compass Features

One of the great features of MongoDB is that it has a flexible data model. 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 a subset of the data in a collection and analyzes the documents from within this subset.

Data Vizualization

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. This allows for the ability to easily choose, sort, and query the collection. All based on the data presented in the schema visualization. The same results can certainly be obtained with shell commands. However, the time and effort involved to get there is much greater.

Database & Collection Interaction

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 MongoDB collections, indexes can have a huge impact on the performance of queries. Compass provides an intuitive interface for index creation. Once created 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
Create Index with Compass
Index Used
Find with a defined and used Index

Once again, all of this can be done in the shell right? We can create an index in the shell with db.collection.createIndex() and we can get explain 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 as well for a more in-depth look at the results.

Dev-Ops features

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 for the metrics of Operations, Read & 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 and mongotop, and the profiler 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.

Wrap Up

I realize that Compass is not the end-all answer to MongoDB management. Not all functionality of managing and maintaining a MongoDB database server and associated collections is possible. 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 X. 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 it for your Windows, OS X, or Linux system and discover a new way to visualize your MongoDB data and graphically manage your system.

There are a lot of MongoDB specific terms in this post. I created a MongoDB Dictionary skill for the Amazon Echo line of products. Check it out and you can say “Alexa, ask MongoDB what is the definition of a collection?” and get a helpful response.


Follow me on Twitter @kenwalger to get the latest updates on my postings.

Facebooktwitterredditlinkedinmail

MongoDB Atlas

I have been using MongoDB for a few years now for various personal projects and I really enjoy the features and flexibility it offers me as a developer. I have taken several great classes on, and from, MongoDB in that time frame as well. As with any technology not only is there a lot to learn in general. There is also a lot to continue to learn to stay up to date and relevant. One of the subjects taught is about MongoDB’s availability and ability to scale both vertically (more RAM, IO capacity, and CPU availability) as well as horizontally (sharding). Another subject that is heavily taught is the idea of clusters and replica sets.

Learning Options

Now I am just a single developer trying to learn technologies, increase my skills, and develop best practices when using them. As such I personally do not have the resources to purchase multiple servers. And constantly increase their hardware, or have them distributed across the country to understand latency issues. I can set up a replica set on the same laptop on which I write my blogs, to get a basic understanding of what is happening but I think a few things get lost in the learning process when boiling things down to a single Intel processor and no network connections between servers.

What options does one have to learn about and use some of these “big boy” features of MongoDB? Or, to prototype applications using real world settings? MongoDB launched a database-as-a-service (DBaaS) platform called Atlas in 2016 and is an opportunity to utilize many of the “big boy” features without having to personally fund a server farm in my garage. I can’t tell you how excited I was about this.

Now I could start clusters in different configurations. Then set up and use multiple replica sets and perform on-the-fly changes to my test servers with ease. I still had to pay a usage fee though. Therefore, I would set up servers, run a few tests, then tear down the servers to avoid any long-lasting fees. As such, I was able to get practice with the technology. It still posed a challenge to showcase some of my projects connecting to a live database.

Atlas M0 Tier

Enter March 2017… MongoDB announced an awesome feature and offering within their Atlas product. A free cluster tier called M0. This allows anyone and everyone who has been interested in using Atlas to utilize MongoDB in the cloud. Further, it is in a clustered environment without even having to give them a credit card. Talk about a great offering for people wanting to use this exciting technology.

Now that we can have access to Atlas and a free cluster, what can we do with Atlas? What’s all the excitement behind it? Well, first off it provides an incredibly intuitive GUI to set up a MongoDB cluster in a variety of regions and with a variety of features. As one might expect the free M0 cluster doesn’t allow for all of the server size features that are available. However, for prototyping it is great. And when your application is ready to move up to a cluster size beyond M0, the GUI is there to make the transition rather pain-free.

Atlas also provides for us, as users that care about our data and not just an easy interface, many built in features. Such as security, replication, backups, automated upgrades, and fine-grained monitoring, to name a few. It allows for many of the painful tasks of database maintenance to be handled by MongoDB. And have the ability to provide alerts when things need more personal attention.

Wrap Up

Of course, there are lots of reasons why people don’t like the idea of storing their data in the cloud, outside their control, on someone else’s hardware. I’m not going to step into that argument. People seem to have strong opinions on the matter in both directions. However, if you are thinking of trying a cloud implementation of MongoDB, I think Atlas is definitely worth a look.

There are several MongoDB specific terms in this post. I created a MongoDB Dictionary skill for the Amazon Echo line of products. Check it out and you can say “Alexa, ask MongoDB for the definition of sharding?” and get a helpful response.


Follow me on Twitter @kenwalger to get the latest updates on my postings.

 

Facebooktwitterredditlinkedinmail