How to downgrade mongo shell version from 4.4 to 3.6?

I’m having mongodb version conflict.
On the server, mongodb version 3.6 is already installed.
But I didn’t know and tried to install mongodb 4.4 lts version.
Now in the terminal, I’m having WARNING: shell and server versions do not match in the terminal.
I wanna downgrade only mongo shell version to 3.6.8 in order to be compatible with server in safe way.
Or I wanna rollback my installation of mongodb version 4.4.
Can you please help me because I’m lost? :sweat_smile:

It is a warning alert.I don’t think it will impact your work

Why do you wan’t to downgrade DB?
Instead you can upgrade your shell to latest version on your localhost/terminal

My boss wants me to leave everything as before. So I’m planning to downgrade the shell which is upgraded by me.

It is probably worth putting some advise here about explaining to your boss that you don’t know what you are doing and doing a risk assessment about following advise from internet experts on a community forum.

Hopefully this is not a major system and any further mistakes are not a Resume Generating Event.

From your post it is difficult to tell what state you have managed to get to. There is the possibility you have upgraded the mongod binary as well and are a service restart or server reboot away from downtime(3.6 to 4.4 direct upgrade won’t start)

Please provide:

  • What OS your installation is on.
  • The server and shell versions output from mongo when you connect.
  • What steps you took on your “upgrade”.

As a note the 3.6 version went End of Life April 2021. So you should be upgrading, but also be following the upgrade path and procedures outlined in the documentation.

1 Like

Hello Chris. I’m sorry for my late reply.
I’m using Ubuntu-20.04.
Running mongo --version output MongoDB shell version v4.4.6
Running mongod --version output db version v3.6.8

I was installing mongodb with this article.
I was stuck at running sudo apt install mongodb-org because of something mongodb-tools , Sorry I don’t remember it clearly. Seems like mongodb shell upgraded but mongodb version didn’t.

Thanks for your help.

Thanks @Patrick_Edward

I suspect your 3.6 installation is from the ubuntu repository not the MongoDB one. Please help me confirm this with:
dpkg-query -S /usr/bin/mongod


My apologies for very late reply. The problem is solved by my senior. He said he removed the incorrect apt file in /etc/apt. Now the mongo shell version and mongodb version is 3.6. As you said, I should consider using mongo 4.4 now. Thanks for your help and I really appreciated it ! :smile:

That is where we were heading.

To get to the latest release you have 3 upgrade steps to perform, they are well documented.

4.0 Upgrade
4.2 Upgrade
4.4 Upgrade

As well check out for courses on learning and running mongodb.

1 Like

Hi @Patrick_Edward,

Quick clarification on the upgrade path (since the original discussion was about versions of the mongo shell): @chris’ links are for the the in-place upgrade path for MongoDB major server release versions.

If you are only concerned with running the mongo shell, you should install the correct version to match your server release (i.e. a 3.6.x mongo shell for use with a MongoDB 3.6.x server release) or use an administration tool which is not as closely tied to the server release version:

There are some other server upgrade approaches as discussed on Replace mongodb binaries all at once?, but typically admins want to upgrade without downtime so follow the documented upgrade path recommended by @chris.