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:
- 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
- Ad hoc queries: MongoDB supports searching by field, range queries, and regular expressions searches. It often provides queries to return specific fields within documents
- Indexing: Indexes can be created to improve the performance of searches within MongoDB
- Automatic Load Balancing: MongoDB uses the concept of sharding to scale horizontally by splitting data across multiple MongoDB instances
- 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();
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:
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:
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:
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.