'Best way for migrating/converting Microsoft SQL Database to MongoDB Database?
I have a big Microsoft SQL Database (10000+ records, 40 tables, procedure scripts, etc. This is a database containing information for all students of a university. But a new system was rebuilt on NodeJS and MongoDB. The old system used Microsoft technology (.NET, ASP, Microsoft SQL ...). And now, I want to move the entire old database into the new database system. What should I do? Is it possible to connect NodeJS to Microsoft SQL server? Or migrating/convert?
Solution 1:[1]
First off, the database is not that big. So performance etc. should not be your concern.
You should just write a script which reads all the data from the SQL Server database, and inserts it into the MongoDB instance.
What this script looks like is up to you - only you know the schemas for the two databases and how to map from one to another.
While the migration is taking place, you could just stop the whole system, so there aren't any records in the SQL database which are omitted. You could do it with no downtime, but it would be (1) a larger engineering effort and (2) probably not worth it, for at most half an hour of downtime, of which the actual migration should be less than a minute.
Solution 2:[2]
The most important point to consider here is schema design.. MongoDB is a document orient database and can handle 1-N/N-N in a single document itself.. There might be tools available to map things to make it easier. Take a look at Mongify.
Though a better approach is to write a batch framework for this job. 40 tables aren't that much, you should be able to get this done fairly quickly. I'm not aware of nodejs ecosystem, but java/spring already has so many frameworks to build upon.
Hope this helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Horia Coman |
| Solution 2 | AmitKumar |
