Docker mongodb 4.4 to 5.0 upgrade...HOW it doesn't work :(

My rocketchat install is barking at me complaining about the mongo db being on 4.4. OK no problem i’ll upgrade to mongodb 5.0 NOPE. How is this procedure not documented by rocketchat? We’re all expected to be mongodb experts now?

Anyways, in-place upgrade fails completely rocketchat doesn’t come online. OK i’ll backup the database and restore it to a new installation of rocketchat following the instructions here:

NOPE no luck, if I attempt to restore it fails to import many items. If I connect to the mongodb cotainer and manually drop all of the existing databases then restore the restore works fine but now rocketchat starts up to the setup-wizard every time so still no luck.

I greatly appreciate any help! Sadly i’m dangerously close to trying to switch to mattermost because i’m nervous the lack of documentation in this regard will force me to lose years of data at some point.

I’m just a hobbyist who is short on time, I can’t be a database expert expected to keep up with rapidly changing software when it would be so easy for rocketchat to update their documentation about this topic.

Hi, If you are using a web browser as a client connecting to the server, try clearing cookies.

I had a similar experience when I was maintenancing the server and database.
Once the environment fails to build, the server sends a wizard screen to register a new site.
Even if you successfully accomplish this by revising the maintenance method, the server will try to resume the wizard screen from the point of interruption.
When I deleted the cookies, the login screen to the restored workspace appeared. :slight_smile:

Thank you for the reply. I figured this out in case someone from the interwebs stumbles on this in the future:

  1. Follow the instructions here to create a database dump:

docker exec <database_name (this is really the docker -ps name)> sh -c 'mongodump --archive' > db.dump

Now for me it was important to drop the existing rocketchat database that was populated when bringing up the new rocketchat instance before trying to import my database dump. Stop the rocketchat container but leave the database container running for the rest of these steps.

Connect to the database container and run:

mongo
use rocketchat
db.dropDatabase()
  1. The important part is to connect to the new mongodb container and make sure the featureCompatibilityVersion is set to the same version as the database you are importing from.

Run these commands in the database container.

mongo

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

Above checks the existing setting

db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )

Above changes the setting.

  1. Now proceed to import the database dump with the old db version, in this case 4.4

docker exec -i <database_name> sh -c 'mongorestore --archive' < db.dump

Then immediately change to the new version:

db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )

Now stop the database containers and start both it and the rocketchat container back up and everything should work (at least it did for me).

Hopefully this helps someone else, I still cannot believe rocketchat wont spend 5 minutes of dev time to add this to their wiki. The mind boggles sometimes.