Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Export MongoDB to SQL in 5 Steps

Posted on: 03/06/2019 (last updated: 21/11/2022) by Dakota Karlsson

Take a look at our guide for SQL to MongoDB Migration in the opposite direction.

In this tutorial, we’ll show you how to export your MongoDB data directly to a live SQL database using Studio 3T and our new MongoDB to SQL Migration feature.

First things first

  1. Studio 3T: Make sure you have Studio 3T up and running.
  2. SQL database: Have your SQL connection details ready. I’ll be using SQL Server for this tutorial, but Studio 3T officially supports MySQL, PostgreSQL, and Oracle as well.

For our MongoDB to SQL migration, we’ll make use of the two datasets:

  • Raleigh Durham Airport Weather History
  • Air Traffic Passenger Statistics

You’ll find the collections in a zip file called ‘Aviation Data’ at the bottom of this article.

Prefer to watch? Skip to the video tutorial.

1 – Open SQL Migration

Click on SQL Migration from the Global Toolbar then choose MongoDB → SQL Migration.

Alternatively, right click in the Connection Tree, go to SQL Migration, and click on MongoDB → SQL Migration.


2 – Choose the MongoDB source connection

Now we need to connect to our MongoDB server that holds the collections we wish to migrate.

To do this, click on Click here to connect to a server.

Now we have two options: connect to an existing MongoDB server or create a new connection, which first-time users will likely need to do.

To create a new MongoDB connection, click on New Connection.

Create a new MongoDB Connection

Enter the relevant details in the Server, Authentication, SSL, SSH Tunnel, Proxy and Advanced tabs.

Create a new MongoDB Connection

Click Save, then Connect.

You can then simply choose this connection from the list for your next migration.

Select the MongoDB Connection

3 – Choose your SQL target connection or directory

The next step is to choose our target SQL database.

Studio 3T lets us directly connect to a SQL server and immediately migrate our data, or save this migration as a SQL file path that can be run later at our convenience.

If SQL target = Server


Click on Click here to connect to a server.

Similar to Step 2, this will open up the SQL Connection Manager.

Create a new SQL connection by clicking on New Connection. Fill out the Server and SSH Tunnel tabs with the details needed.

Click Save. Then click OK. You can then simply choose the saved connection for future migrations.

If SQL target = Directory

If you choose to save to a SQL file path, Studio 3T will let you choose the location of the statement file as well as the database type.

4 – Add export units

Now that we’ve successfully connected to both our MongoDB and SQL servers, it’s time to choose our data.

Click on Add export units. Each export unit corresponds to one single export of a source collection.

Here we’re going to choose the collections we wish to migrate to MySQL, which are:

  • Raleigh Durham Airport Weather History
  • Air Traffic Passenger Statistics

Be sure that you have downloaded the zip file containing both collections, which is attached at the end of this article.

Click OK.

Studio 3T generates a SQL table preview of the data.

Upon selecting the databases, Studio 3T will generate a SQL Table Preview of your data. Here we can see the SQL table(s) that will be made from our MongoDB collections.

You can further configure how map MongoDB fields should be mapped to SQL tables and columns by making use of the Mappings functionality.

5 – Run the export

Is the SQL Table Preview looking good? Then it’s time to run the export by clicking on Run Migration in the top toolbar.

Track the export in the Operations window which you’ll find in the bottom left hand corner of Studio 3T.

Click Run Migration to begin the migration

Once the export is complete, open your SQL database and hit refresh to see your newly imported data.

With some combinations of SQL clients and databases, results might not show up immediately. A reconnect to the database should help in those cases.

Video tutorial

Next steps

Find helpful tutorials on how to query SQL with MongoDB, migrate between the two databases, and more.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Dakota Karlsson

New to the world of databases, Dakota hails from a rural town in Texas and is learning just how exciting databases can be. After brief stops in the Big Sky state and a few years in Scandinavia, he now calls Berlin home and spends his spare time involved in the Berlin music scene and experiencing the art of German cuisine.

Article navigation

Related articles

  • MongoDB Monitoring, Auditing & Authentication: 3 Steps to Secure Your Database
  • MongoDB DevOps Checklist: 3 Steps to Secure Your Database
  • What’s New in Studio 3T 2020.7 | Export Documents from Table View to CSV, Edit find() Queries During Export & More
  • What’s New in Studio 3T 2022.1 – SQL Connection Import/Export, MongoDB-AWS authentication
  • Studio 3T SQL Export or Migration? #STUDIO3T_AMA

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected