To completely remove MongoDB, you have to remove the MongoDB services, MongoDB packages, the databases, and any log files. Using this guide, you will be able to uninstall MongoDB from Linux, Mac, and Windows. The basic uninstallation process is the same, with some variations in the commands depending on the operating system. Remember to keep a backup of your data, as the uninstall cannot be reversed.
How to Uninstall MongoDB
Every new version of MongoDB comes with a host of new features and benefits. For example, MongoDB 7.0, the latest stable version, comes with advanced features for Atlas Search Index management, and several improvements in performance, security, migrations, developer experience, and much more. If you are planning to install a new version of MongoDB, this is the perfect in-depth guide to help you completely uninstall MongoDB (older version) and get started with the new versions.
Opting for a database solution to skip local installation? Check out our fully managed MongoDB Atlas setup guide.
Table of contents
How to uninstall MongoDB from Ubuntu Linux
To uninstall MongoDB from Linux, you have to stop the daemon process, and remove the MongoDB applications, configuration files, data files, and MongoDB log files. All of this should be done from the terminal.
You must have sudo access, i.e., a superuser. To get sudo access, log in as an admin and add yourself to the sudo group
Type the following commands one by one to uninstall MongoDB:
1. Stop MongoDB process:
2. Permanently remove MongoDB packages:
3. Remove the data directories, MongoDB database(s), and log files:
4. To check if MongoDB is successfully uninstalled, type:
If you wish to reinstall MongoDB on Linux, follow the links below:
- Install MongoDB on Linux
- Install MongoDB Community Edition on Ubuntu
- Install MongoDB Community Edition on Red Hat or CentOS
Alternatively, you can spin a free MongoDB Atlas cluster to access the MongoDB database as a service, thus avoiding the need for install/uninstall.
How to uninstall MongoDB from Mac
For uninstalling MongoDB from Mac, follow the below steps on the terminal:
1. Check if any mongo service is running:
2. If you had installed MongoDB using Homebrew, unload mongodb:
3. Kill the mongod process, if it exists:
4. If you had installed MongoDB using brew, uninstall MongoDB with the below command:
5. If you installed MongoDB manually (without Homebrew), then use:
Remove database files:
To check if the uninstall was properly done, check if any MongoDB files are still present:
To install a newer MongoDB version, visit Install MongoDB on Mac. Alternatively, avoid the need for install/uninstall in the future by trying free today.
How to uninstall MongoDB from Windows
For uninstalling MongoDB from Windows, use any of the following options.
Uninstall MongoDB using Settings
1. Click on the start menu or search bar near the start menu and open system settings.

2. On the settings page, double click on Apps (on the left side of the window), and then double click on installed apps.

3. From the list of applications shown, click on the MongoDB application. You can also search in the list for MongoDB. Click on the three dots on the right side and select uninstall.

Uninstall MongoDB using Control Panel (Windows 10)
- Open Control Panel using the Start menu or command prompt (control command).

2. Once the Control Panel is open, click on “Uninstall a program” under the Programs/Programs and Features heading.

3. Select and right click on MongoDB.

4. Click on Uninstall. Windows will ask you to confirm the uninstall. Click on Yes. The above will completely remove MongoDB databases, MongoDB packages, and MongoDB data.
Whichever way you use for uninstalling MongoDB on Windows, make sure to restart your machine for the changes to reflect. You can reinstall MongoDB on Windows from the official MongoDB documentation page. Alternatively, avoid the need to install/uninstall in the future by trying MongoDB Atlas for free.
There are many reasons why you should use MongoDB Atlas, other than the fact that you don't have to install/uninstall a MongoDB database on your machine. MongoDB Atlas runs on the cloud and provides a host of features, including built-in security and automated backups. Try a free cluster today to explore the benefits.
FAQs
You can remove MongoDB from Windows 10 using many approaches, including from command prompt, Control Panel, Apps and Features, and so on. Read our guide How to uninstall MongoDB from Windows to learn the detailed steps.
To remove MongoDB from your Mac OS, follow the simple steps given in our in-depth How to uninstall MongoDB from Mac guide.
To uninstall MongoDB from Linux-based systems, you need superuser access. Once you have that, you can remove the MongoDB services, packages, and data directories. Each Linux distribution might differ slightly, but you can refer to How to uninstall MongoDB from Linux for detailed commands on Debian-based systems.
Get started with Atlas today
- 125+ regions worldwide
- Sample data sets
- Always-on authentication
- End-to-end encryption
- Command line tools