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

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.