How to uninstall MongoDB in Ubuntu

How to uninstall MongoDB in Ubuntu

How to uninstall MongoDB in Ubuntu -A complete Guide.

First things first, if you want to uninstall MongoDB in Ubuntu then first You will need to stop MongoDB service from your computer or laptop whichever you may be using, So if you don't know how to disable MongoDB then simply type $ sudo service mongod stop OR $ sudo systemctl stop mongod as seen in the image below.

Now the MongoDB is completely disabled but it is not uninstalled yet, for that you will need to enter this command which you can also see in the image below $ sudo apt-get purge mongodb-org*

uinistall mongodb step 1

Many people miss this step now MongoDB is installed in Ubuntu but the log files of MongoDB and Database files are yet to be deleted that you can do from the following command $ sudo rm -r /var/log/mongodb this will only remove the log files.

uinistall mongodb step 2

Now, you are almost done, to remove database files of MongoDb from Ubuntu type this command and hit enter $ sudo rm -r /var/lib/mongodb

uinistall mongodb step 3

Step 1: Disable/Stop MogoDB

Type and $ sudo apt-get purge mongodb-org* and hit Enter

Step 2: Clear Log Files

Type $ sudo rm -r /var/log/mongodb and hit Enter

Step 3: Clear Database Files

Type  $ sudo rm -r /var/lib/mongodb and hit Enter

How to uninstall MongoDB in Ubuntu

More about Ubuntu and MongoDB 

Ubuntu is a very powerful operating system which is for Linux operators, it is released in three editions: Desktop, Server, and Core and all the editions can run on the computer alone for e.g. in Windows. It is a popular operating system for cloud computing with support for OpenStack. If you are interested in reading more about Ubuntu and its uses and all that you can check the official website of Ubuntu here.


One of the recommended ways to install Ubuntu for Desktop users is via a bootable CD you can also run it through a hard disk but that will be the default option and will help in preventing accidental data loss.

MongoDB is a document-oriented no sequel database. It was released in the month of August 2009, it offers flexibility to the developers to work with the current data modules because MongoDB is document-based so it eliminates complex work and effort for the developers and it is schema-free which means that the keys fixed in the document are not fixed at all, as a result, massive data migrations can be ruled out. Due to its flexibility, it has replaced many popular software out there. 

There are various ways through which MongoDB and Ubuntu can be used together as they will provide a combo of synergy when used strategically and by applying the right commands. These types of software and operating systems require special knowledge which completely out of the scope if you are not familiar with coding, programming, etc. To get the complete Juice of you can check the MongoDB Official Website here where you can get access to various resources which will help you, as this article is dedicated to the uninstallation of MongoDB in Ubunto those aspects are out of the scope of this article, but still, we have provided some basic information that can serve as a stepping stone.

Post a Comment