MongoDB is a general-purpose, object-oriented, and dynamic NoSQL database server for the development of modern dynamic applications. In MongoDB, data objects are stored in collections as individual documents, which is different from traditional relational databases that use rows and columns.It provides a free downloadable community edition and an enterprise edition as part of the Mongo Advanced subscription, and has more features, including: LDAP, Kerberos, etc.
MongoDB Compass is MongoDB’s official GUI tool that can help create, read, update, and delete databases graphically. This eliminates the need to run Mongo commands for each task. It allows people to explore data, run queries, and interact with databases with full CRUD capabilities. MongoDB is a better alternative to Mongo Shell, because you can complete all operations in the Shell, such as:
- Get real-time server statistics.
- Manage indexes.
- It can be extended by plugins
- Visualize and explore the data stored in the database.
- Understand performance issues through a visual explanation plan
- Validate data using JSON schema validation rules.
Armed with the above knowledge, we will start this guide to introduce how to install and use MongoDB Compass on CentOS 8/7 | RockyLinux 8.
Step 1: Download MongoDB Compass on CentOS 7/8 | Rocky Linux 8
Unlike the MongoDB database, the MongoDB compass is not available in the base repository of CentOS 8/7 | Rocky Linux 8 so we must download it from the official website. This is done by visiting the official Compass download page and selecting the platform on the right, as shown below.
For CentOS 8/7 | Rocky Linux 8 installation, we will select the RedHat package and download the .rpm file.
Or, you can download the stable version of MongoDB Compass | Rocky Linux 8 on CentOS 8/7 and use Wget as follows. First, you need to install Wget on your system.
sudo apt install wget
Then go ahead and download the MongoDB compass as shown below.At the time of writing this guide, the latest stable version is 1.28.1 Download it as follows.
cd Downloads
wget https://downloads.mongodb.com/compass/mongodb-compass-1.28.1.x86_64.rpm
If you want to download other versions of MongoDB Compass, please copy the download link on the official page and use Wget as above.
Step 2: Install MongoDB Compass on CentOS 8/7 | Rocky Linux 8
On CentOS 8/7 | Rocky Linux 8 Launch the terminal and navigate to the directory you downloaded .rpm document. If you use a browser, your download will go to the download directory.Navigate to the directory and you should see the following file
$
ls
mongodb-compass-*.x86_64.rpm
Now use yum to install MongoDB Compass | Rocky Linux 8 on CentOS 8/7 using the following commands.
sudo yum localinstall
mongodb-compass-*.x86_64.rpm
Dependency tree:
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mongodb-compass
x86_64 1.28.1-1.el7 @commandline 100 M
Installing dependencies:
libXScrnSaver
x86_64 1.2.3-1.el8 appstream 30 k
mailx
x86_64 12.5-29.el8 baseos 256 k
ncurses-compat-libs
x86_64 6.1-7.20180224.el8.1 baseos 327 k
postfix
x86_64 2:3.5.8-1.el8 baseos 1.5 M
redhat-lsb-core
x86_64 4.1-47.el8 appstream 44 k
redhat-lsb-submod-security
x86_64 4.1-47.el8 appstream 21 k
spax
x86_64 1.5.3-13.el8 baseos 215 k
Transaction Summary
================================================================================
Install 8 Packages
Total size: 103 M
Total download size: 2.4 M
Installed size: 455 M
Is this ok [y/N]:
y
Step 3: Run MongoDB Compass on CentOS 8/7 | Rocky Linux 8
To run MongoDB Compass, navigate to the application menu and launch it. It is shown below.
After starting MongoDB Compass, the plugin will load as shown.
After successfully loading the plug-in, you will see this welcome window.
Step 4: Connect to the MongoDB database
If you have a MongoDB instance installed on your system, you can connect to it with a single click connect As follows.
Or, use this guide to create a database and install MongoDB 5 on CentOS 8/7 and RHEL 8/7
You will connect to an existing database on the system.
Step 5: Connect to the remote database instance
If you want to connect to a remote database instance, click “ Fill in the connection fields individually “. In the Hostname section, you can connect to local host Database or Remote system By entering its host name.
When finished, click Connect. You should see your database as follows.
Step 6: Use MongoDB Compass to create a database
After connecting to the database, you can easily create and edit the database.In this database, let’s create a database named mongotestdb And a collection named “ User details “. Click Create Database on the above page
Click” Create a database” You should see your database as shown below.
Now we click on it to enter the database.
In the collection we created, we will try to add data to it. First, click on it to open it.
On the above page, you can manually add data or import data from a document, usually a JSON or CSV file. Browse and load it, then select the uploaded file type and click Import.
To create a file manually, click “Add Data” and select “Insert Document” in the drop-down list that appears.
You will enter the details of your collection in the area where you paste one or more documents.Leave ID As it is, then click Insert.
You should add your favorites.
Step 7: Delete a database in MongoDB Compass.
You can easily delete the database in MongoDB Compass by navigating to the database on the left and clicking Delete database as the picture shows
Exit, Disconnect by clicking the instance in the MongoDB Compass connect The button in the upper left corner and select disconnect as the picture shows.
in conclusion.
This concludes the guide on how to install and use MongoDB Compass on CentOS 8/7 | Rocky Linux 8. We have seen how MongoDB Compass helps people easily create, edit and delete databases without using shell commands. I hope this guide is helpful to you.
See more information on our page: