MongoDB is one of the more popular NoSQL databases on the market (with over 50% of the market share). This database is a great option for enterprise businesses or any company looking to leverage massive data sets.
SEE: Hiring Kit: Database engineer (TechRepublic Premium)
For those just looking to adopt MongoDB, you might be on the search for a GUI tool to make working with the data easier. One of the best options you’ll find is Compass. With this graphical database manager, you can build, import and query data, create aggregation pipelines, visually explore and analyze your data, and even run commands within a shell.
Compass is free and open-source, and can be installed on Linux, macOS and Windows.
I want to show you how to install Compass on Pop!_OS Linux, as the installation on both macOS and Windows is as simple as installing any application on each platform. For those using a different flavor of Linux, the developers have made installable binary packages available for both Ubuntu and RHEL-based distributions. Once we have it installed, I’ll show you how to connect it to a remote MongoDB server. Do note that using MongoDB Compass is the same, regardless of what platform you are using.
What you’ll need
To install Compass on Pop!_OS Linux, you’ll need a running instance of the OS and a user with sudo privileges. You’ll also need an instance of MongoDB running on a remote server. That’s it. Let’s get this DB party started.
How to install Compass
The first thing we’ll do is download the .deb file for Compass. Save that file to your ~/Downloads directory and then open a terminal window. From the terminal issue the command:
sudo dpkg -i ~/Downloads/mongodb-compass*.deb
The installation should go off without a hitch. You’ll find the Compass launcher in your desktop menu.
How to connect Compass to your remote server
Before we fire up Compass, we need to configure our MongoDB server for remote access. Back at the terminal window, SSH to your MongoDB server and open the MongoDB configuration file with the command:
sudo nano /etc/mongodb.conf
In that file, you should see the line:
bind_ip = 127.0.0.1
You can either change that line to:
bind_ip = 0.0.0.0
bind_IP = 127.0.0.1, SERVER
Where SERVER is the IP address of the machine hosting Compass. Use the first configuration option to allow connections from any machine on your network and the second option to specify only those machines that should have access to the MongoDB service.
Save and close the file. Restart the MongoDB service with:
sudo systemctl restart mongodb
Open Compass and walk through the welcome screens. You’ll eventually find yourself on a privacy configuration window (Figure A), where you can enable/disable a few features and privacy-related options.
Click Start Using Compass and you’ll be greeted by the New Connection screen (Figure B).
The only thing you should need to change is the localhost address. In place of that, type the IP address of the server hosting MongoDB and then click Connect. Compass should instantly connect with your server and present you with a listing of the databases hosted by MongoDB (Figure C).
Congratulations, you now have a fantastic GUI that makes managing your remote MongoDB databases considerably easier. Enjoy the ride.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays