[mongodb] What version of MongoDB is installed on Ubuntu

Hi I'm a bit of a shell n00b.

Can anyone tell me how I would check the version of MongoDB that is installed on my Linux Ubuntu machine?

I see that my MongoDB shell version: 1.2.2 so Im pretty sure that MongoDB itself is out dated too. And does anyone know of any 'How to update MongoDB' docs? I find mongodb.org to be a bit confusing.

Please and thank you.


Ok if I use db.version() inside of mongo shell it says 1.2.2

If I $ mongod --version I get this:

db version v1.2.2, pdfile version 4.5
Wed Oct 16 10:28:22 git version: nogitversion

I ran

sudo apt-get update
sudo apt-get install mongodb

and get

sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mongodb is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 179 not upgraded.

mongod --version
db version v1.2.2, pdfile version 4.5
Wed Oct 16 10:31:07 git version: nogitversion

So why isn't it updating? Is apt-get pointing at the wrong repo / source?

This question is related to mongodb shell ubuntu

The answer is


inside shell:

mongod --version

In the terminal just write : $ mongod --version


To be complete, a short introduction for "shell noobs":

First of all, start your shell - you can find it inside the common desktop environments under the name "Terminal" or "Shell" somewhere in the desktops application menu.

You can also try using the key combo CTRL+F2, followed by one of those commands (depending on the desktop envrionment you're using) and the ENTER key:

xfce4-terminal
gnome-console
terminal
rxvt
konsole

If all of the above fail, try using xterm - it'll work in most cases.

Hint for the following commands: Execute the commands without the $ - it's just a marker identifying that you're on the shell.

After that just fire up mongod with the --version flag:

$ mongod --version

It shows you then something like

$ mongod --version
db version v2.4.6
Wed Oct 16 16:17:00.241 git version: nogitversion

To update it just execute

$ sudo apt-get update

and then

$ sudo apt-get install mongodb

In the terminal just enter the traditional command:

mongod --version

When you entered in mongo shell using "mongo" command , that time only you will notice

MongoDB shell version v3.4.0-rc2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.0-rc2

also you can try command,in mongo shell , db.version()


Examples related to mongodb

Server Discovery And Monitoring engine is deprecated Avoid "current URL string parser is deprecated" warning by setting useNewUrlParser to true MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified Failed to start mongod.service: Unit mongod.service not found db.collection is not a function when using MongoClient v3.0 MongoError: connect ECONNREFUSED 127.0.0.1:27017 MongoDB: How To Delete All Records Of A Collection in MongoDB Shell? How to resolve Nodejs: Error: ENOENT: no such file or directory How to create a DB for MongoDB container on start up?

Examples related to shell

Comparing a variable with a string python not working when redirecting from bash script Get first line of a shell command's output How to run shell script file using nodejs? Run bash command on jenkins pipeline Way to create multiline comments in Bash? How to do multiline shell script in Ansible How to check if a file exists in a shell script How to check if an environment variable exists and get its value? Curl to return http status code along with the response docker entrypoint running bash script gets "permission denied"

Examples related to ubuntu

grep's at sign caught as whitespace "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? "Repository does not have a release file" error ping: google.com: Temporary failure in name resolution How to install JDK 11 under Ubuntu? How to upgrade Python version to 3.7? Issue in installing php7.2-mcrypt Install Qt on Ubuntu Failed to start mongod.service: Unit mongod.service not found