How to upgrade from v3.6.3 to v4.4.5?

I accidentally upgraded 4.0 to 5.0(instead of 4.2).

How it happened? I went to link “upgrade standalone to 4.2” and copied the command for keys and source repo but it was set to 5.0 (as it turns out, I have to choose the version no. in the left sidebar). And then as usual I ran sudo apt-get update && sudo apt-get upgrade.

What can I do now?

  • I tried to remove 5.0 source repo and then add 4.2 source repo and key and then run sudo apt-get update && sudo apt-get upgrade. It seemed to work and install 4.2 but when I checked mongod --version, it showed 5.0.9.
  • I tried to uninstall complete mongodb without removing data folder using sudo apt-get purge mongoldb-org. But I get this error
    E: Couldn't find package by regex/glob mongoldb-org-5.0.list 
    E: Couldn't find package by regex/glob mongoldb-org-4.0.list 
    E: Couldn't find package by regex/glob mongoldb-org-3.6.list 
    E: Couldn't find package by regex/glob mongoldb-org-3.2.list 
    

I’m on Ubuntu 18.04 currently