0

I followed all the instructions on this page, and aft apt-get it says

mongodb-org is already the newest version (4.0.10).

but when i start it again and run mongod --version, it still says

db version v3.6.13

How do I switch to the new version?

results from sudo systemctl status mongodb.service

● mongodb.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

stackers
  • 307
  • 1
  • 3
  • 14
  • Where did the other MongoDB installation come from? – Michael Hampton Jun 08 '19 at 01:07
  • im not sure, someone installed it for me – stackers Jun 09 '19 at 15:07
  • You have two versions of `mongodb` installed and version 3.6.13 is the first one in your PATH hence it being referenced in your second output. The only one installed by `apt` is `4.0.10` which is why it specifies that it's already the latest version. Did you or someone else build another one from source on the system? – Nasir Riley Jun 13 '19 at 00:53

3 Answers3

1

In the end it worked after I ran

sudo apt-get install -y mongodb-org=4.0.10

and then

sudo apt-get upgrade -y --fix-missing --allow-unauthenticated
stackers
  • 307
  • 1
  • 3
  • 14
0

You should check what mongodb service is running. Try the command: sudo systemctl status mongodb.service. It will show you which mongodb is running.

0

It could happen that only mongodb-org package was updated. To check that you can run:

sudo apt list --installed | grep mongodb

All steps for upgrading 3.6 => 4.0

sudo systemctl stop mongod
wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add -
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

Important part:

sudo apt-get update && sudo apt-get install -y mongodb-org=4.0.14 mongodb-org-server=4.0.14 mongodb-org-shell=4.0.14 mongodb-org-mongos=4.0.14 mongodb-org-tools=4.0.14
sudo systemctl start mongod
mongo -version
MongoDB shell version v4.0.14
...
mongod -version
db version v4.0.14
...

Btw, to check what's the latest patch version available run:

apt policy mongodb-org

That worked for me, I hope it will for you too :)

tteskac
  • 1
  • 1