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)

3
  • Where did the other MongoDB installation come from? Jun 8, 2019 at 1:07
  • im not sure, someone installed it for me
    – stackers
    Jun 9, 2019 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? Jun 13, 2019 at 0:53

3 Answers 3

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
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.

1
  • ran that and added the result to the post, not sure what it means though
    – stackers
    Jun 12, 2019 at 19:02
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 :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .