How to check if MongoDB is installed + MongoDB Version

In this MongoDB tutorial, We are going to learn How to check if MongoDB is installed or not and How to check the MongoDB version. And we will also cover the implementation of this task on different operating systems. These are the following topics that we are going to cover in this tutorial:

  • How to check if MongoDB is installed in windows
  • How to check the MongoDB version in windows
  • How to check if MongoDB is installed in ubuntu
  • How to check the MongoDB version in ubuntu
  • How to check MongoDB is installed on mac
  • How to check the MongoDB version in mac

How to check if MongoDB is installed in windows

For checking MongoDB is installed or not you need to follow the below instructions step by step:

  • open command prompt
  • go to till mongod.exe file in bin folder
C:\Program Files\MongoDB\Server\5.0\bin>
  • Now start the MongoDB server by using mongo command
C:\Program Files\MongoDB\Server\5.0\bin>mongo
how we can start mongodb server in windows
Start the MongoDB server in windows

Here, you can see MongoDB server is running so you can say MongoDB is installed in your system.

Note that sometimes errors come at this time of starting the server because we haven’t set the path so you have to set the path manually in the environment variable.

Check in the environment variable if the path hasn’t been set then set it and restart the server.

Follow the following step, If you want to set the path in your system:

  • Go to system properties, click on environment variables and click on path in system variable.
  • Click on new and add the path of MongoDB till bin folder and click on OK and save it.
How to set path of MongoDB in windows
How to set path of MongoDB in windows
  • Now you successfully set the path of MongoDB.

If still, you are facing some issues then you can also refer to How to install MongoDB. And follow the installation steps from starting.

How to check the MongoDB version in windows

In MongoDB, you can check the version of MongoDB in windows by using this command

C:\Program Files\MongoDB\Server\5.0\bin>mongod --version
How to check the MongoDB version

This way you can check the version of MongoDB. Currently, we are using MongoDB’s latest version 5.0.2.

Also Read: How to create new database in MongoDB

How to check if MongoDB is installed in ubuntu

For checking the MongoDB is installed in Ubuntu or not you have to follow these commands:

  • Start the MongoDB server
$ sudo service mongod start

With the help of this, you start the MongoDB server in ubuntu if exists.

If this gives you an error then you have to first install MongoDB in your system.

  • Check the status of MongoDB server is running or not
$ sudo service mongod status

With the help of this command, you can check the status of MongoDB that it is in a running state or not. If it is not running then first of all you have to install MongoDB in your system.

Read: How does MongoDB create collection

How to check the MongoDB version in ubuntu

In MongoDB, you can check the version of MongoDB in ubuntu by using this command

$ mongod --version

By using this command, you can use check the version of MongoDB in ubuntu.

How to check if MongoDB is installed in mac

For checking the MongoDB is installed in mac or not you have to follow these commands:

ps -ef | grep mongod | grep -v grep | wc -l | tr -d ' '

This command will give you the number of MongoDB processes running. If it is other than 0, then you have MongoDB and running in your system.

Start the MongoDB server use the following command

mongod

This command will start the MongoDB server if it runs successfully then MongoDB is in your system otherwise you need to first install it.

How to check the MongoDB version in mac

In MongoDB, you can check the version of MongoDB in mac by using this command

mongod --version

By using this command, you can use check the version of MongoDB in mac.

You may like reading the following articles.

In this tutorial, we have learned “ How to check if MongoDB is installed or not and check the MongoDB version  and we will also cover different operating systems and check MongoDB installed or not and check version.

These are some of the topics that we covered in this tutorial

  • How to check if MongoDB is installed in windows
  • How to check the MongoDB version in windows
  • How to check if MongoDB is installed in ubuntu
  • How to check the MongoDB version in ubuntu
  • How to check MongoDB is installed on mac
  • How to check the MongoDB version in mac