MongoDB to HarperDB Migrator: Tutorial
Tags: tutorial, database, showdev, webdev
Published: 2020-10-12 17:16:09

As you may already know, our goal at HarperDB is to be the easiest, most user-friendly, and intuitive database there is. Keeping in line with this, along with the many resources, features, and packages that come with HarperDB, we recently launched the HarperDB Migrator tool. 

The HarperDB Migrator allows you to quickly and easily replicate data from your existing database into HarperDB. You can access the [HarperDB Migrator](https://studio.harperdb.io/resources/dbmigrator?utm_source=devtomargo&utm_medium=content&utm_campaign=dbmigrator) under the Resources tab in the Studio.

----------

_Curious about why developers are migrating from MongoDB to HarperDB?_ As Jake, our Director of Product Management, states in [this blog](https://harperdb.io/blog/migrate-from-mongodb-to-harperdb/?utm_source=devtomargo&utm_medium=content&utm_campaign=dbmigrator): While MongoDB might be the most prolific NoSQL database in existence, there are certain cases that could be better served with another solution. Examples would be use cases where you need both SQL & NoSQL, rapid app development, integration, edge computing and distributed computing. Maybe you saw our [benchmark](https://harperdb.io/harperdb-vs-mongodb/?utm_source=devtomargo&utm_medium=content&utm_campaign=dbmigrator) and learned that HarperDB is 37 times faster than MongoDB at less than half the price. HarperDB also has a native REST API, supports SQL on JSON, and scales out of the box for concurrent operations. [Give it a try](https://harperdb.io/docs/getting-started/) and let us know your thoughts! 

----------

##Migrate to HarperDB with these Simple Steps

___We currently support migration from MongoDB, but we're working on other platforms___.

First you’ll need to download the correct migrator tool for your system (Mac, Windows, or Linux). Then install and open the HarperDB Migrator app.

Once the app is open, you can configure the connection to both of your databases. Enter this info in the fields provided. (You can find this info in the HarperDB Studio either on the card on the Instance page or on the config tab).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rhpmxmqpbtaqtc5a6ogh.png)

Click the white checkmarks on both the Source and the Destination. You will see green boxes once the connection is confirmed. 
_Note: If there’s an error and you see red instead of green, it means that either the Migrator can’t access the server or the credentials are incorrect._

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j61n6hc1vouu8z9159aj.png)

Next the Migrator will display your existing MongoDB databases and HarperDB schemas, expanding databases/schemas will show respective collections/tables. If you need to create a new HarperDB table to migrate data to, you can do so, then click the Refresh button to see the new table. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g8koi1l4fwhzilmwkl19.png)

Then click the next arrow on the right and the migration process will begin. 
_Note: Larger datasets will be batched in groups of 1000 documents/rows._


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9c0z5xfw5q1st3s1vmke.png)

Finally, you will see the completion message on your DB Migrator screen. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eq4aaxdwi5fyplkps4yl.png)

Now you can check your associated table in HarperDB and you will see the migrated data, and you can repeat the process for as many tables as needed. The MongoDB ObjectID will automatically be stored in the HarperDB hash_attribute.

###See, it really is as easy as 1, 2, 3!