A GUI for MongoDB with Compass Community
If you’re a developer getting acquainted with MongoDB there are times when you might want to visually see what’s happening with your data without having to look up the query syntax to retrieve the data. It’s time like these where a Graphical User Interface (GUI) for MongoDB can be extremely handy. There are a few different options for a GUI for MongoDB but we’re gonna take a look at MongoDB’s own interface called Compass. We find that it’s a great introduction to MongoDB and a simple and quick tool to have in your tool belt.
What can it do?
Compass allows you to get out of the command line interface and lets you visualize, explore, and modify your data all without having to know little to no query syntax. Let’s discuss some specific use cases: View a list of your databases. View a list of your databases. View how many indexes exist in each database. View how many collections are in each database. View how many documents are in a collection. View the documents in a collection. You can page through the documents. Filter through the documents of a collection with a simple search bar. View how much storage each database is storing. Perform any and all CRUD operations on your documents ( Create, Read, Update, Delete). View data in an easily readable format. View the amount of storage taken up by an index. Perform aggregations. * Get the execution time of a query.
Compass vs Compass Community Edition
There are two versions of Compass, Compass Community and Compass. Compass Community is the edition for developers which is free and which we used for this article. There is also a full version for enterprise use which contains all features but is only available with a subscription.
Some of the more advanced features contained in the enterprise version that are not in Compass Community are Schema Analysis, Server Stats, and Document Validation.
How to get it?
You can download Compass from the MongoDB where there is a simple step by step of how to install it for your operating system. For this article we installed the Community edition on OS X and had zero issues.
How to Set it Up
We had zero issues setting up MongoDB Compass Community. You’ll need to have MongoDB running in order for it to connect to the port MongoDB is running on.
For a standard install you can run MongoDB in the background with the following command:
This will start MongoDB on the default port of 27017. Now open Compass you can start right away because all the defaults are setup to run on localhost with the default port of 27017.
Now Compass can connect to our instance of MongoDB and shows us a list of all the databases:
If we select a database we can see all the collections within that database:
If you drill down further into a collection you can see the documents in a collection:
You can see from each screenshot that useful information is organize in each window. In this last view of a collection there is a search bar which allows you to filter documents without knowing query syntax although you may want to click on the “i” link because the “Project” and “Collation” fields are not obvious.
As you can see there is also tabs and buttons for useful operations you can perform like creation and deletion that you can perform with the click of a button.
If you were looking for an easy way to visualize the data in MongoDB we hope this introduced you to a useful tool in MongoDB Compass. We find that this is a good tool for developers getting acquainted with MongoDB but you’ll want want to evaluate other options when you move to a production environment. If you need any help with MongoDB please don’t hesitate to reach out to us at Object Rocket.
Pilot the ObjectRocket Platform Free!
Try Fully-Managed CockroachDB, Elasticsearch, MongoDB, PostgreSQL (Beta) or Redis.Get Started