MongoDB

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.

Yatin

An experience full-stack engineer well versed with Core Java, Spring/Springboot, MVC, Security, AOP, Frontend (Angular & React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button