MongoDB upgrade requires that you must upgrade to each version of MongoDB along the way.
...
https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-standalone/ and https://www.mongodb.com/docs/v5.0/tutorial/install-mongodb-on-debian/
Commands summarised here:
systemctl stop mongod
wget -qO - https: //www .mongodb.org /static/pgp/server-5 .0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-5.0.gpg --dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-5.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/5.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo ap t-get update
sudo apt-get upgrade -y mongodb-org
------------------------------------
If you get an error
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-database-tools-extra_5.0.27_amd64.deb
Fix it by using: sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-database-tools-extra_5.0.27_amd64.deb
then sudo apt-get upgrade -y mongodb-org
and answer N to keep your currently installed version of /etc/mongod.conf -------------------------------------
systemctl stop mongod ; systemctl start mongod ; systemctl daemon-reload ; systemctl is-active mongod ; systemctl status mongod
|
...
systemctl stop mongod
wget -qO - https: //www .mongodb.org /static/pgp/server-6 .0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get upgrade -y mongodb-org
and answer N to keep your currently installed version of /etc/mongod.conf
systemctl stop mongod ; systemctl start mongod ; systemctl daemon-reload ; systemctl is-active mongod ; systemctl status mongod
|
...