DB Not Removing After uninstalled and reinstalled mongodb

Hi Team,
Kindly help me
we are using Rockylinux, and we have found unwanted databases in my MongoDB
so I have tried uninstalling and reinstalling the MongoDB still old database is still maintained on my server
Here i inclued screenshot for your reference

Hi @Saravanaprasad_k,
You can simply use the method dropDatabase(), to remove the old database.
From the documentation:

Regards

1 Like

above suggestion is about removing from inside. but you may want to clean them all without thinking what to delete :slight_smile: then read ahead.

your old installations seems to use “default” data path that won’t be removed upon uninstallation. usually /data/db, but can be somewhere under /var. it needs manual removal through OS. you should find the config file or that default path for your OS distro, then remove that folder as well. this way, your next re-installation will be clean.

a third option is to change the init file and use different data folders. this requires you to learn some more DB admin concepts. so I will leave it to you.

1 Like