Can we do a mongo 4.2 dump and then restore to mongo 6.0.3 directly

We plan to upgrade from 4.2 to 6.0.3 by mongodump and mongorestore. Can we dump from 4.2 and restore to 6.0.3 directly ?
Is is a must to go through version 4.2 → 4.4 → 5.0 → 6.0 ? This will take considerable long time to upgrade between each versions.
Your advice / experience is very welcome. Thank you

Hi @Daniel_Wan ,
I suggest you to try a dump & restore from 4.2 to 5.0 (coz Is one major release) and the upgrade ti 6.0.* in a test enviroment, but the best practice as you’ ve mentioned is to through the version 4.2 → 4.4 → 5.0 → 6.0.


Welcome to the MongoDB community @Daniel_Wan !

The recommended (and most throughly tested) upgrade path is to do in-place upgrades through successive major releases of MongoDB ( 4.2 → 4.4 → 5.0 → 6.0 as you have suggested).

However, if you want to fast forward through several major release upgrades and downtime is acceptable, you can consider using mongodump and mongorestore to go directly from your current release to the latest. As with any major system change, I recommend testing this in a representative staging or QA environment before upgrading in production. You may discover a few issues that need to be corrected in the source data (for example, stricter validation of collection options), however I believe these should all be fixable.

Please also see this response including alternative approaches such as automation: Replace mongodb binaries all at once? - #3 by Stennie.

4.2 => 5.0 is actually two major releases (4.4 and 5.0). The release versioning scheme changed starting from MongoDB 5.0 so going forward the annual major release versions are #.0 (5.0, 6.0, …).


1 Like

Thanks all !!

your feedback is appreciated and we will go for version by version upgrade which looks much more promising