Home » Software Development » MongoDB » How to Check the MongoDB Version

About Yatin

Yatin
The author is graduated in Electronics & Telecommunication. During his studies, he has been involved with a significant number of projects ranging from programming and software engineering to telecommunications analysis. He works as a technical lead in the information technology sector where he is primarily involved with projects based on Java/J2EE technologies platform and novel UI technologies.

How to Check the MongoDB Version

Hello, in this tutorial we will see how to check the exact version of the installed MongoDB.

1. Introduction

If you have installed the MongoDB application on Windows or Ubuntu operating system and you don’t remember the version, then follow the below steps to check the MongoDB version. It’s very simple to check the version of MongoDB.

1.1 What is MongoDB?

  • MongoDB is a NoSQL document database that provides high performance, high availability, and easy scalability
  • Documents (objects) map nicely to programming language data types
  • Embedded documents and arrays reduce need for joins
  • Dynamic schema makes polymorphism easier

1.2 MongoDB Features

Below are few of the reasons why someone should start using MongoDB:

  1. Document-oriented: Since MongoDB is a NoSQL type database, instead of having data in a relational type format, it stores the data in documents. Thus, making MongoDB very flexible
  2. Ad hoc queries: MongoDB supports searching by field, range queries, and regular expressions searches. It often provides queries to return specific fields within documents
  3. Indexing: Indexes can be created to improve the performance of searches within MongoDB
  4. Automatic Load Balancing: MongoDB uses the concept of sharding to scale horizontally by splitting data across multiple MongoDB instances
  5. Replication: MongoDB can provide high availability with replica sets

2. How to check the MongoDB Version

In MongoDB, it is important to remember the database version for future upgrades. In this article, we will learn how to determine the MongoDB version directly through the shell console or via MongoDB reference method:

2.1 MongoDB Reference Method

In MongoDB, there is a reference method which returns the version of the mongod or the mongo instance. The following example shows how this can be done:

Check MongoDB Version Command

> db.version();
Tip
The same command can be executed in any operating system environment to check the MongoDB version.

If the command is executed successfully, the following output will be shown:

Fig. 1: MongoDB Version Output

Fig. 1: MongoDB Version Output

2.2 Shell Console

2.2.1 Windows Console

Open a Windows command prompt and just fire up mongod command with the --version flag:

Windows Shell Console

mongod --version

If the command is executed successfully, the following output will be shown:

Fig. 2: Windows Shell Console - MongoDB Version Output

Fig. 2: Windows Shell Console – MongoDB Version Output

2.2.2 Ubuntu Console

Open an Ubuntu terminal and just fire up mongod command with the --version flag:

Ubuntu Shell Console

$ mongod --version

If the command is executed successfully, the following output will be shown:

Fig. 3: Ubuntu Shell Console - MongoDB Version Output

Fig. 3: Ubuntu Shell Console – MongoDB Version Output

3. Conclusion

The main goal of this article is to give an introduction to MongoDB and how to check the Version of the installed MongoDB.

(No Ratings Yet)
Start the discussion Views Tweet it!

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

 

Leave a Reply

avatar
  Subscribe  
Notify of