Reusing older posts to not reinvent the wheel...
Removing the MongoDB service
1:
The command...
C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.conf --remove
Is used to just remove the service.
NB: the configuration file may have the suffix .cfg.
2: Or you can use the Windows general way with:
sc delete MongoDB
Removing the MongoDB installation
NB: if you delete the MongoDB directory on the disk, you will still see MongoDB in the list of installed programs.
You can uninstall MongoDB automatically using a script doing something like this:
- Find the package Id:
In Powershell, do:
Get-Package -Name 'MongoDB package name' | fl TagId
The 'MongoDB package name' is the name you can see in the control panel / Programs and features.
- Use this Id to uninstall the MongoDB package automatically:
msiexec /x {TagId}
Replace the TagID string with the Id you find before.
Keep the {}.
.msi
( which was the recommended approach ) then you should simply be able to uninstall like any other program. May possibly leave data directories behind, but I presume you know how to delete files? If you did not install from an.msi
then delete the directory. The install process does not actually "install a service" by itself, and required a manual step. See Install MongoDB On Windows in the core documentation. – Sheree