My DB upgrade was done by:
MongoDB upgrade
Change two references in docker-compose.yml file. Change it to the version which you are converting TO. E.g. change 4.0 → 4.2.
Run:
docker-compose stop mongo
docker-compose rm mongo
docker-compose up -d mongo
docker exe -it rocketchat_mongo_1 bash
mongo
db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
exit
exit
Change the ‘4.2’ in the adminCommand to the relevant version.
Repeat it for each DB upgrade, e.g. 4.2 → 4.4 and 4-4 > 5.0.
Make sure you’ve also uncommented:
./data/dump:/dump
in the docker-compose-yml file, and created the directory
mkdir /opt/rocketchat/data/dump
if you wish to create database backups/dumps. Actually don’t know if it’s also needed for DB conversions.