Import data with different mongo versions

Hi,

I have a database with mongo version 6.0.4 and I need to populate it with information that will be obtained from other environments, however, not all of them have the same version, some of them have versions 4.4 and 5 implemented, due to this I intend to upgrade the environments to 6.0.4, therefore, is it necessary to have the same version of mongo in the source and destination to import the information? Or is it possible to do it without carrying out the upgrade?

Regards.

From old to new? Super easy, new to old? Not advised because then you have data types and things that aren’t supported in the older versions.

Do this instead:

  • Build Docker containers of MongoDB 6.0s.
  • Migrate the indexes to said containers
  • Export all the collections as BSON data in the old DBs.
  • Import all the collections with the indexes into the new 6.0 containers
  • Verify functionalities and make sure everything is all how you want it to be and working.
  • Connect them all to your infrastructure and point appropriate services to each.
  • Delete the old MongoDBs because at this point you don’t care about them and they’ve been effectively replaced with fully functional, latest build MongoDBs.
  • Relax and enjoy life knowing you have no headaches for trying to upgrade anything, or trying to hassle with a bunch of unforeseen issues and no outages.

Easy guide with multiple ways to get the data over:

1 Like