Suppose you have already installed MongoDB in your system and forget which version of MongoDB is installed. Then this post is for you. In this tutorial you will get to know all the examples to check MongoDB version.
Examples to check MongoDB version
There may be many examples to check the MongoDB version. But here in this tutorial you will know the best and mostly used example.
Examples 1: Check MongoDB version on Windows
If you are using Windows OS then you can check the version of the mongodb using the command prompt. For that open your command prompt and type the mongod –version. You will get the version with build info for the mongodb.
If you are getting the mongod command error then you have to first set the path for the mongodb bin directory inside the PATH variable of environment variables.
Select your installed version of your MongoDB. In my case it is 7.0 + version so directory will 7.
Now if you type the mongod –version on the command prompt you will get the version.
Example 2: Use MongoDB shell
You can also use your MongoDB shell to know the db version. For that you will open your terminal or prompt and type the mongosh and later use the db.version() function to know its version. But you should make sure that you must have installed mongodb shell on your system. If not then install it from the Official URL.
Example 3: Check MongoDB version on Linux
If you have installed MongoDB on Linux using package manager then you can check its version using the package manager. You will use the dpkg and yum or apt command with grep to find the version of the mongodb.
dpkg -l | grep mongo
yum list installed | grep mongo
Example 4: Find the MongoDB version MongoDB Compass
You can also know which version of MongoDB is installed or not using the MongoDB compass. The MongoDB compass is User Interface that allows you to interact the database through mouse. To check the version of MongoDB you have to first connect to the Database server and then click on the three dot. After that click on the connection info you will know the version of the MongoDB.
Thats all the best examples that I have give here to Check MongoDB version. You can use any methods as your wish. I hope you have liked this tutorial. You can contact us for more help if you have any doubt.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.