Getting your data out of MongoDB Atlas

MongoDB Atlas stores your databases in the cloud, and you can export that data to your own computer in a few different formats. The most common way is to use the mongodump tool, which creates a backup folder you can download. You can also export individual collections as JSON files directly from the Atlas web interface if you only need a small amount of data.

The method you choose depends on how much data you're exporting and what you plan to do with it. If you need everything, mongodump is faster and more reliable. If you need just one table or collection, the web interface export works fine. Both methods require you to have the right permissions in your Atlas project.

Key Takeaways

  • MongoDB Atlas offers two main export paths: using the mongodump command-line tool for complete backups, or exporting individual collections as JSON through the web interface.
  • You must have Project Data Access Read/Write or higher permissions in your Atlas project to export data.
  • Mongodump requires you to install MongoDB Database Tools on your computer and create a connection string with your Atlas credentials.
  • Web interface exports work for smaller collections but can time out on very large datasets, so mongodump is better for production databases.
  • Your exported data arrives as BSON files (mongodump) or JSON files (web export), and you can import either format into another MongoDB instance or convert them for other uses.

Check your permissions before you start

Before attempting any export, log into your MongoDB Atlas account and navigate to your project. Click the Access Manager tab on the left sidebar. Find your username in the list and check the Project Permissions column. You need at least Project Data Access Read Only or higher to export data.

If you don't have the right permissions, contact whoever manages your Atlas project and ask them to grant you read access. They can do this from the same Access Manager page by clicking your name and changing your role. This usually takes a few minutes to take effect.

Export a single collection through the web interface

The web interface method works best when you need just one or two collections and they're not extremely large. Go to your project in Atlas, click Collections under your cluster name, and find the collection you want to export. Click the three dots next to the collection name and select Export Collection.

Atlas will ask you to choose a file format. Select JSON for a human-readable format you can open in any text editor, or CSV if you want to work with the data in Excel or another spreadsheet program. Click Export and the file will download to your computer within a few seconds for small collections. If your collection is very large (over 100 MB), this method may time out — use mongodump instead.

Export everything with mongodump

Mongodump is the command-line tool MongoDB provides for backing up entire databases or clusters. It's faster than the web interface and works reliably on large datasets. First, download MongoDB Database Tools from the MongoDB website (search "MongoDB Database Tools download"). Choose the version that matches your operating system — Windows, macOS, or Linux.

Install the tools by following the prompts. On Windows, this adds mongodump to your system automatically. On macOS and Linux, you may need to add the installation folder to your system path, or navigate to the folder each time you run the command. Open your terminal or command prompt and type mongodump --version to confirm it installed correctly.

Create a connection string for mongodump

Go back to your MongoDB Atlas project and click Connect on the cluster you want to export. Select Connect with MongoDB Tools. Atlas will show you a connection string that looks like this: mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority. Copy this entire string.

The connection string includes a placeholder for your password. Replace password with your actual Atlas password — the one you use to log into Atlas, not a database user password. If you don't remember it, you can reset it from your account settings. Make sure there are no spaces in the string and that it's all on one line.

Run mongodump and download your backup

In your terminal or command prompt, type the following command, replacing the connection string with the one you copied:

mongodump --uri="mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority" --out=./my-backup

Press Enter and mongodump will start downloading your data. You'll see progress messages showing which databases and collections are being backed up. The process can take several minutes for large clusters. When it finishes, you'll see a message saying the dump is complete.

Open your file explorer and navigate to the folder where you ran the command. You'll see a new folder called my-backup (or whatever name you put after --out=). This folder contains all your data in BSON format, organized by database and collection. You can copy this folder anywhere on your computer or move it to an external drive for storage.

Convert your exported data to other formats

If you exported with mongodump, your data is in BSON format, which is MongoDB's native binary format. To convert it to JSON so you can read it in a text editor or import it elsewhere, you can use the bsondump tool, which comes with MongoDB Database Tools. Navigate to your backup folder in the terminal and run a command like bsondump admin/system.version.bson > output.json to convert individual files.

If you need your data in a completely different format like CSV or SQL, you have a few options. You can import the BSON files back into a temporary MongoDB instance and then export as JSON, or use online conversion tools if your dataset is small. For large production data, consider using a dedicated ETL tool like Talend or Apache NiFi, though these require more setup.

Frequently Asked Questions

Can I export data if I'm not the project owner?

Yes, as long as the project owner or an admin has given you Project Data Access Read Only or higher permissions. You don't need to be the owner, just have the right role assigned to your account in the Access Manager.

What's the difference between mongodump and the web interface export?

Mongodump backs up your entire database in BSON format and works on any size dataset. The web interface exports individual collections as JSON or CSV and can time out on very large collections. Use mongodump for complete backups and the web interface for quick exports of small collections.

How long does it take to export a large database?

Speed depends on your database size and your internet connection. A few gigabytes typically takes 5 to 15 minutes with mongodump. The web interface is slower and may fail on datasets over 100 MB. If your export is taking longer than expected, check your internet connection and make sure your Atlas cluster is running.

Can I import my exported data back into Atlas?

Yes. Use the mongorestore tool (which comes with MongoDB Database Tools) to import BSON files back into any MongoDB instance, including Atlas. The command is similar to mongodump but uses your connection string and points to your backup folder instead.

What if I get an error saying "connection refused"?

This usually means your connection string is wrong or your Atlas cluster is paused. Double-check that you copied the entire connection string correctly and replaced the password placeholder with your actual password. If your cluster is paused, go to the Atlas dashboard and click the play button to restart it, then try again.