Following are the commands which I used to upgrade my mongodb version from 2.6.9 to latest, but its still showing me the previous version. Let me know what I am doing wrong
I'm in the exact same situation, followed the exact same steps, and had the same issue.
What worked for me was:
Uninstalling:
sudo service mongod stop
sudo apt-get purge mongodb-org*
Do NOT remove data directories - all your data will be lost if doing so.
Note: Calling sudo apt-get purge mongodb-org*
deletes the mongod.conf
file. In case you want to keep this file after the update, make sure you create a backup copy of it and use it after the new version has been installed.
Then install mongodb with:
sudo apt-get install -y mongodb-org
This assumes that you've already performed the previous installation steps (importing the public key, creating a list file, reloading local package database) as you've stated.