how to uninstall mongodb package in centos code example
Example: uninstaall mongodb from centos7
1)Stop MongoDB.
Stop the mongod process by issuing the following command:
sudo service mongod stop
2)Remove Packages.
Remove any MongoDB packages that you had previously installed.
sudo yum erase $(rpm -qa | grep mongodb-org)
3)Remove Data Directories.
Remove MongoDB databases and log files.
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo