Version command difference

[user@qa2-vi-101 ~]$ mongo
MongoDB shell version: 3.0.6
connecting to: test
tracker:PRIMARY> version()
3.0.6
tracker:PRIMARY> db.version()
2.4.14

what is the difference between these two methods?

One seems to be for the Mongo Shell, the other for the remote Mongo database.

Hi vamsitron409,

This is your Mongo shell version which you might have installed on your system. i.e. 3.0.6

This is the Mongo server version to which you have connected using mongo command mongo <hostname> --username <username>.

Hope it clears!

Kanika

I don’t think so…

[user@qa2-vi-101 ~]$ mongo --version
MongoDB shell version: 3.0.6
[user@qa2-vi-101 ~]$ mongod --version
db version v3.0.6
git version: 1ef45a23a4c5e3480ac919b28afcba3c615488f2

It’s certainly an odd discrepancy. But the manual page from MongoDB says that it is…

https://docs.mongodb.com/manual/reference/method/db.version/

1 Like