Dump and Restore between version 3.6 and 5.0

I have a mongo replicaset on version 3.6.2. I want to upgrade it to 5.0. I do not want to perform the step by step upgrade process. Instead I want to create a new setup i.e replicaset in version 5.0.
I want to migrate the data to the new setup. I am planning to do the below steps:

  1. Take mongo dump using mongodump command in version 3.6.2
  2. Transfer the dump to the new instance
  3. Restore the dump in version 5.0 using mongorestore command

I tried this in the testing environment and it worked just fine. Can this cause any issues with the data. I could not find any info about thi in the mongo docs. Can I face issues later on because of the version difference?

1 Like

Hello and welcome to the community forum, @Ishrat Jahan!!

We do not suggest you to upgrade directly from 3.6 to 5.0 as there might be a great difference in the features and enhancements between the versions. Please refer to the following documentation here which explains the same.

Therefore, the recommended and tested in-place method is to upgrade the MongoDB version by upgrading sequentially. Hence, for you the upgrade sequence would be 3.6 → 4.0 → 4.2 → 4.4 → 5.0.

The reason why we suggest a step wise upgrade is because each major version is released with new features or enhancements of the legacy features. Hence to maintain the data integrity, the step wise upgrade is recommended. Please refer to the following documentation Upgrade to 5.0 to read more on the same.

In addition, we have a related discussion on a similar topic MongoDB community that you might want to take a look for further information/documentation.

Please do let us know if you have any concerns.

Thanks
Aasawari

2 Likes

Is there a 4.6 version of mongo ? I think we directly jump from 4.4 → 5 https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-replica-set/#upgrade-version-path

Thank you for pointing it out @Ishrat_Jahan.

It was MongoDB version 5.0 after 4.4. I would edit the post for future inconsistencies.

Thanks
Aasawari

2 Likes

@Aasawari Hi, I am using docker images of mongodb 4.4 in my server, now I want upgrade it to mongodb 7.0,
with docker could i upgrade to 7.0 directly? before that I will dump my data and restore it in mongodb 7.0.