MongoDB and import to SQL server as a relational model


My company has the requirement to be able to export mongoDB data into sql server while mapping the tables.

Im wondering does mongo provides any tools for this?

Example we have a collection in the database and the document schema looks something like this

   membershipId: string,
   name: string,

Is there any tools out there that can help import this document schema into a SQL database and create the correct columns for us with the correct types?
Does mongo provide any tools for this.

how to export schema without relation from MongoDB and import to SQL server as a relational model
how to export data from MongoDB and import to SQL server based on imported schema


Hi @Conor_O_Shea ,

There are several ways to do so.

  1. Use connectors to read data from MongoDB transform it into a SQL connector. A kafka connecters will most likely do the job. We have a tutorial on moving data from SQL to MongoDB but you can use a similar approach for the other way:
    Data Movement from Oracle to MongoDB Made Easy with Apache Kafka | MongoDB Blog
  2. You can use a BI connector that can be connected by ODBC or JDBC and use a Driver to map the data and insert it via JDBC or ODBC to the target database:

There are other ways to script the data transformation as many RDBMS drivers have JSON to table mapping capabilities…

Hope thats helpful

1 Like