Backup & Restore, Upgrade and Migration between different MongoDB Versions

Dear Friends,

My current setup is MongoDB 3.4 version with replica set ( Arbiter, Master and Slave)
I am planning to upgrade to latest version of 5.0.2.
I am using SSL certificate on database level.
Note: I am planning for parallel setup not in place upgrade.
Someone please clarify the below doubts.

Q1: Can backup from 3.4 and restore onto 5.0 directly or do I need to use intermediate version ?
Q2: Mine is Replica Set with 3 nodes, can we backup databases from Master only instead of replica set and restore onto Stand alone ?
Q3: Replication will work between different versions of MongoDB ?
Q4: Is there any possibility directly to import and export the databases between the different MongoDB versions.
Q5: I am using SSL certificate, Consider the example: Today I took the backup, tomorrow SSL certificate was expired and renewed and unfortunately database corrupted, need to restore the database from yesterday’s backup,
While taking the backup used different SSL certificate and while restoring using the renewed certificate.
MongoDB allow the restore ?

I am new to MongoDB , kindly bare with me and Thanks in advance for your valuable advise. .

Hi @Mahammad_Jilan!! :wave:
Welcome to the community forum!!

The mongodump and mongorestore is only recommended between the major releases. For more, please refer to the documentation here which explains more on the same.
In my test situation, I tried exporting a 3.4 collection using mongoexport and importing it into a 5.0 instance using mongoimport, and it appears to be working. If you choose this strategy, please carry out extensive analysis to verify that there are no unexpected outcomes.

If I understand your question correctly, you need to do a mongodump and mongorestore from a Primary member of replica set to a stand alone MongoDB. In that case, yes, this case is possible provided the version of replica set and stand-alone MongoDB are on the same major version. Please visit for documentation here

Replication works between different MongoDB versions only for the purpose of upgrading a replica set. It was not designed for long term use, and definitely not designed to take a production workload. Please refer to the following documentation to know about feature compatibility version behaviour.

Yes, import and export between the MongoDB versions is possible. Similar to your question, I tried to import and export between different versions of MongoDB and it worked for me, however please test extensively with your data to ensure that no data would be lost or changed by the process.

According to my understanding, the TSL/SSL is a transport layer security mechanism and hence it would have no indulgence on how the data is restored. Therefore, the certificate expiry should not be an issue and hence should not affect the backup or restore.

Please let us know if you have any further questions.

Thanks
Aasawari

1 Like

Dear Aasawari,

Thank you so much for your response and answers, appreciated.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.