MongoDB Version

There are many places where you can get the version of MongoDB Server running.

MongoDB Version when MongoDB Server is started

When you start MongoDB Server, the version of MongoDB is echoed to the screen as db version v4.0.3.

Windows

C:\>"C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe"
2018-10-10T11:02:43.496+0530 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-10-10T11:02:43.799+0530 I CONTROL  [initandlisten] MongoDB starting : pid=11716 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-QRVE3I1
2018-10-10T11:02:43.800+0530 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-10-10T11:02:43.801+0530 I CONTROL  [initandlisten] db version v4.0.3
2018-10-10T11:02:43.804+0530 I CONTROL  [initandlisten] git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
2018-10-10T11:02:43.804+0530 I CONTROL  [initandlisten] allocator: tcmalloc

Ubuntu

In Ubuntu, run the following command to start Mongo Daemon.

sudo service mongod start
ADVERTISEMENT

MongoDB version when Mongo Shell is started

When you start a Mongo Shell, versions of MongoDB Server and Mongo Shell are echoed to the screen.

Windows

C:\>"C:\Program Files\MongoDB\Server\4.0\bin\mongo.exe"
MongoDB shell version v4.0.3
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("fde958c1-c5e8-444b-87df-eec09d18cec4") }
MongoDB server version: 4.0.3

Using db.version() command

To know the MongoDB version, you can also run db.version() command in Mongo Shell.

Windows

Check MongoDB Version - db.version()

Conclusion

In this MongoDB Tutorial, we have learned how to check MongoDB Version through different ways like while starting MongoDB Server, Starting Mongo Shell and through db.version() command.