DEV Community

Cover image for Data Migration Between Two MongoDB Atlas Instances ( Connections )
Ali Amjad
Ali Amjad

Posted on

Data Migration Between Two MongoDB Atlas Instances ( Connections )

As for how easy it can be to set up a MongoDB Atlas account and database, it will just become harder when you try to move the data around.

Lately, at our company, we have decided to migrate our current development MongoDB Instance into another Instance and In this article, I will discuss how I approached and solved this task.

So the challenging part of this Migration was our database design, because of its complexity, the Application is a built upon Microservices and Microservice Architecture that includes around +30 Microservices with +10 Databases that handle Different Groups of Microservices separately, and then each of them contains around hundreds of collections that even each of them contains thousands of data.

According to the Official Documentation of MongoDb, you could export each collection separately which is not helpful for our case because we are dealing with a lot of collections.

Another Solution might be using the MongoDump command to dump the whole Database together, but again not that helpful as it's done manually for exporting and importing each of the Databases.

After enough research regarding the best way to handle this situation, I have come to a tool that could do this in a matter of seconds which I will be discussing below.

  1. First of All, Prepare your Host and Target MongoDB URI or at least a connection for each of them

  2. Then, We are using a tool called NoSQL Booster.

NoSQLBooster is a cross-platform GUI tool for MongoDB v2.6-5.0, which provides a build-in MongoDB script debuggerMongoDB script debugger, and comprehensive server monitoring tools, chaining fluent query, SQL query, query code generator, task scheduling, and much more.

  1. After you have installed the tool, you will be popped up with adding connections from the first step.

Connections pop up

in this step , I am Connecting via my Atlas URI, so you can simply connect other atlases or any MongoDB from any server.

  1. you will see your connections loaded in the side like mine in the picture

Loaded Schema

  1. Only part left is pretty simple, you copy a database and simply paste it into the other connection. it is simple as that, It will load the DB with all of its data and indexes into the other one.

A) Copy A Database from the Host Connection

Copy

B) Paste A Database to the Target Connection

Paste

in my case, I did the copying operation around +10 times and our new database is good to go :).

Thanks for reading this Article, Just wanted to share this experience I had today in this article.

can you do all the DBs together with one click? I am not sure, maybe there is a better solution but this is quickest i have found and used. :)

Top comments (1)

Collapse
 
mohammedjaffer profile image
Mohammad-svg

Nice article, waiting for your another :)