1. Command Line Check
- Open a terminal or command prompt.
- Type the following command and press Enter:
mongod --version
- If MongoDB is installed, it will display the version of the MongoDB shell (e.g.,
MongoDB shell version v4.4.10
). - If the command is not recognized, it means MongoDB is not installed or is not added to the system’s PATH.
2. Check MongoDB Server
- Run the following command to check if the MongoDB server is installed and accessible:
mongod --version
- If installed, it will show the version of the MongoDB server.
3. Search for MongoDB Files
- Check common installation directories:
- Linux:
/usr/bin/mongo
,/usr/bin/mongod
- MacOS:
/usr/local/bin/mongo
,/usr/local/bin/mongod
- Windows: Look in the
C:\Program Files\MongoDB
directory.
- Linux:
- Use a search tool or command to locate MongoDB binaries:
which mongo
Or
find / -name mongo 2>/dev/null
4. Check Services (Linux/Windows)
- Linux: Use the systemd command to see if MongoDB is running:
sudo systemctl status mongod
- Windows: Check the “Services” panel (
services.msc
) forMongoDB
orMongoDB Server
.
5. Alternative: Package Manager
- Linux: Use your package manager to see if MongoDB is installed:
dpkg -l | grep mongodb # Debian/Ubuntu
rpm -qa | grep mongodb # CentOS/RHEL
- MacOS: Check with Homebrew:
brew list | grep mongodb
- Windows: Check “Apps & Features” or the Control Panel for MongoDB entries.
If MongoDB is not installed, you can download it from the official MongoDB website or install it via a package manager suitable for your system.
Here is another link if you have issues with the first one MongoDB Community Edition install.