Database Export from version 5.4.x and import to version 6.4.x

We setup Rocket.Chat to the latest version 6.4.5.
Our old system is on version 5.4.10.

How can we export the database from the old version to the new one.
The content should include all users, teams, channels and direct messages with all conversations.

Is this possible ?

It’s possible. You can use mongodump to do that. The docs have a section for doing this on a Docker instance of Rocket Chat. I’ve found I sometimes needed to use mongorestore with the --drop command to completely destroy the existing database before importing the dump, but the instructions in the docs might work.

Are you importing the database into an instance at a new domain name? If so, this will be trickier if you’re storing images using GridFS, as the domain name is hardcoded in the database, and they’ll break when imported into the database at the new domain.

If you’re not storing images via GridFS and instead any of the other methods, and you’re not moving to a new domain name, that’s not something you need to worry about.

Damn I have a GridFS and my domain might change soon,
is there no way to convert them uploads into file system?

When I was looking into this in the unlikely event I needed to change my domain, I found this community script: GitHub - arminfelder/gridfsmigrate: RocketChat GridFS to filesytem migration script

My notes:

This project converts GridFS storage to Filesystem or S3 storage. Instead of
fixing the GridFS references, it might be easier to migrate to Filesystem
storage. Supposedly, it’s better designed for scaling anyway:
https://docs.rocket.chat/use-rocket.chat/workspace-administration/settings/file-upload/recommendations-for-file-upload

I have not tested it at all and don’t know if it still works. But you could use it as inspiration for your own script, at least; e.g. you wanted to fix the GridFS references and keep using GridFS. If you do end up using it…please report back!

1 Like

thank you, if I change my domain I shall look into it!