0

I am planning to upgrade existing MongoDB installations from 3.6 (or 4.0 depending on the needs) and I find that it is necessary that you do incremental updates during the process, that is you need to upgrade to 3.4 to 3.6 then to 4.0. The process looks tedious and I would like to know if there is a way to migrate the existing data between versions especially for cases such as 3.4 to 4.0 or <3.4 to 3.6 (i.e. one or more version in between).

For example, would dumping the data via mongodump from the older version and restoring it in the new version via mongorestore would work and preserve information such as indexes in the process?

MervS
  • 5,724
  • 3
  • 23
  • 37

1 Answers1

0

You can take backup using mongodump and restore using mongorestore.

By default mongodump produces a file called ..indexes.bson inside each database's dump directory. mongorestore loads that file last within the database. Loading that file builds indexes in the new database. Only the metadata is in these files, so loading it will create the indexes.

So, By using mongodump and mongorestore DB index is preserve.

For best Practice to upgrade Mongo version.

Please check :

https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/ https://optimalbi.com/blog/2018/05/16/upgrading-mongodb-3-4-to-3-6-on-ubuntu-16-04-easy-as-microwave-pie/

Note -> Before update create backup for safe side.

Aabid
  • 953
  • 5
  • 23
IftekharDani
  • 3,619
  • 1
  • 16
  • 21