Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
closed by

I have listed down the command which I used to upgrade my mongodb version from 2.6.9 to latest, but it's still showing the previous version . Please help me out where am I going wrong?

 

Followed commands:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

Result -

Reading package lists... Done

Building dependency tree       

Reading state information... Done

These packages will be upgraded:

  mongodb-org

1 upgraded, 0 newly installed, 0 to remove and 139 not upgraded.

Need to get 3,608 B of archives.

After this operation, 0 B of additional disk space will be used.

Get:1 http://repo.mongodb.org/apt/ubuntu/ trusty/mongodb-org/3.0/multiverse mongodb-org amd64 3.0.2 [3,608 B]

Fetched 3,608 B in 0s (18.3 kB/s)      

(Reading database ... 298790 files and directories currently installed.)

Preparing to unpack .../mongodb-org_3.0.2_amd64.deb ...

arg: upgrade

Unpacking mongodb-org (3.0.2) over (2.6.9) ...

Setting up mongodb-org (3.0.2) ...

After this I restarted the service - sudo service mongod restart

 Kindly tell me how to tackle this problem?

closed

4 Answers

0 votes
by (13k points)
 
Best answer

Confirm the installed version with "mongo --version."

Clear cache: "sudo apt-get clean" and restart MongoDB: "sudo service mongod restart."

Check installation logs in "/var/log/mongodb." Contact MongoDB community or support for help.

0 votes
by (11.7k points)

I have faced this issue as well and I tried this solution:

 

Uninstalling:

sudo service mongod stop

sudo apt-get purge mongodb-org*

I suggest you not to remove your directories as doing so will delete your data. 

Note: If you call sudo apt-get purge mongodb-org* it 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.

Now install mongodb with:

sudo apt-get install -y mongodb-org

I am assuming that you've already performed the previous installation steps as you've stated.

If you want to learn MongoDB, checkout this MongoDB tutorial from Intellipaat.

0 votes
by (11.4k points)
There could be several reasons why your MongoDB is still showing the old version despite upgrading. Let's go through the steps you've followed and see if we can identify the issue:

It seems like you've successfully added the MongoDB repository key and updated the package lists. The output you provided indicates that the package "mongodb-org" will be upgraded.

The upgrade process fetched the MongoDB package version 3.0.2, which is newer than your previous version 2.6.9.

The installation process proceeded, unpacking and setting up the new version.

You mentioned that you restarted the MongoDB service using the command "sudo service mongod restart."

Considering the steps you've taken, it's likely that the upgrade was completed successfully. However, the version displayed might not immediately reflect the change. Here are a few suggestions to tackle this problem:

Confirm the installed version: Run the command "mongo --version" in your terminal to check the MongoDB version. It should display the current installed version, which should now be 3.0.2.

Clear cache and restart: In some cases, the system may cache the old version information. Try clearing the cache by running the command "sudo apt-get clean" and then restart MongoDB once again using "sudo service mongod restart."

Verify the installation logs: Check the MongoDB installation logs to ensure that there were no errors during the process. The logs can typically be found in the "/var/log/mongodb" directory.

By following these steps, you should be able to verify the upgraded MongoDB version. If you continue to experience issues, please provide more details or consult the MongoDB community or support for further assistance.
0 votes
by (7.8k points)
You've successfully followed the MongoDB upgrade process, but the displayed version hasn't changed. Try these steps:

Confirm the installed version using "mongo --version."

Clear the cache with "sudo apt-get clean" and restart MongoDB: "sudo service mongod restart."

Check the installation logs in "/var/log/mongodb" for any errors. Contact MongoDB community or support for further help.

Browse Categories

...