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)

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

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

  • ran that and added the result to the post, not sure what it means though – stackers Jun 12 at 19:02

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.