This article will document the steps required to migrate your MongoDB to a new machine. At the end of this article, you’ll have a MongoDB with identical collections and documents as your previous machine. Without further ado, let’s start.

Problem Statement

I needed to switch my development machine, and I needed to migrate the data in my local MongoDB to the new machine.

Primary objectives

  • Avoid wasting time and effort to recreate dummy data in MongoDB. My projects have 7-8 microservices and databases; each microservice has about 2-3 collections. Thus, I couldn’t imagine recreating that data.

Although my problem is specifically for data migration for a development machine, I believe this article could help you as long as you’re performing migration for MongoDB.

Solution Analysis

The moment I knew I needed to do this migration, I was a bit panicked. I had zero experience in doing MongoDB migration. It’s important to remain calm (sometimes I couldn’t) and resolve the problem bit by bit. I’ll this down into two parts:

  • Back up the MongoDB data
  • Restore the data to the new machine

#mongodb #mongo #database #software-engineering

How to Migrate Your Local MongoDB Database Between Computers
1.45 GEEK