Checking installed MongoDB version on Ubuntu servers


Once you login to Ubuntu server if you want to know the version of installed MongoDB server you can use the following command

mongod --version

That outputs something like following

db version v3.4.8
git version: 8ef456f89f63ab12941fe6b5352b20cff2522da3
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
    distmod: ubuntu1604
    distarch: x86_64
    target_arch: x86_64

from the output you can read the MongoDB version, in this case its 3.4.8

Once you are in Mongo shell/ connected to mongoDB remotely then you can run the following command to check the MongoDB version

> db.version();
4.0.0