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

**URL:** <https://forums.rocket.chat/t/docker-mongodb-4-4-to-5-0-upgrade-how-it-doesnt-work/16640>\
**Category:** Community Support\
**Created:** [April 25, 2023, 7:18pm UTC](https://forums.rocket.chat/t/docker-mongodb-4-4-to-5-0-upgrade-how-it-doesnt-work/16640 "2023-04-25T19:18:35Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Bleo](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Bleo](https://forums.rocket.chat/u/Bleo)\
**Post date:** [April 28, 2023, 2:23am UTC](https://forums.rocket.chat/t/docker-mongodb-4-4-to-5-0-upgrade-how-it-doesnt-work/16640/3 "2023-04-28T02:23:21Z")

</div>

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 Mongo Backup and Restore](https://docs.rocket.chat/deploy/prepare-for-your-deployment/rapid-deployment-methods/docker-and-docker-compose/docker-containers/docker-mongo-backup-and-restore)**

`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:

```auto
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.

---

_[View the full topic](https://forums.rocket.chat/t/docker-mongodb-4-4-to-5-0-upgrade-how-it-doesnt-work/16640)._
