How to Migrate Data from MongoDB-3.4 to MongoDB-4.0 directly

490 views
Skip to first unread message

Rammohan Reddy

unread,
Jul 25, 2019, 11:01:39 PM7/25/19
to mongodb-user
Dear Team,


Currently we are using MongoDB-3.4 as a standalone service in our Application and planning to migrate to MongoDB-4.0.
As per our understanding direct upgrade from 3.4 to 4.0 is not supported (As per the mongoDB documentation).

Can we use below approach to avoid first upgrading to 3.6 and then to 4.0?

Take backup of the data from 3.4 database using mongodump and then restore to 4.0 database using mongorestore
We tested this sample data and observed it is restoring fine in 4.0, however we are not sure whether this option can be considered in production environment.



Thank you.

Stephen Steneker

unread,
Jul 29, 2019, 4:13:05 AM7/29/19
to mongodb-user
Hi,

If you are performing an in-place upgrade you will have to upgrade via successive major releases (so from 3.4 => 3.6 => 4.0). We generally recommend using replica sets for production deployments which makes the upgrade process less disruptive.

If downtime is acceptable, migrating from 3.4 to 4.0 via mongodump and mongorestore is also an option. The most likely issues you will encounter are stricter validation of index and collection options if your deployment was previously upgraded in-place from a version of MongoDB prior to 3.4. Unlike an in-place upgrade, dump & restore will recreate all data files and indexes.

I would definitely recommend testing this procedure in a staging/QA environment with a copy of your production data to ensure there are no unexpected issues that might otherwise delay your production upgrade.

Regards,
Stennie
Reply all
Reply to author
Forward
0 new messages