Upgrade mongo version from 4.2.20 to 6.0.3


i need to upgrade mongodb from 4.2.20 version to 6.0.3. just set up new instance cause require windows 2019.
do i need upgrade step by step following major version like 4.2 > 4.4 or i can just use mongodump in last version 4.2.X then restore it in new instance using mongorestore in mongo version 6.0.3?

Step by step upgrades are the tested and supported method.

Some people have success with a dump/restore but it is not a supported method.

1 Like

btw recommended using mongodump/mongorestore version 4 in new instance installed ver 6 or using latest mongodump in mongo database tools to dump from old version and restore it in new instance?

Use the latest, 100.6.1, good luck.

Oh no, i just restore it using mongorestore ver 4, do u know how to drop all database from last restore? or any command i can use for that operation so i can restore again using dump & restore latest version 100.6.1

If it worked and looks good, don’t bother.

mongorestore has a --drop option to drop any existing collection before restoring it.

1 Like