New Import for Compose MongoDB


We're pleased to announce that we are now enabling importing on MongoDB on Compose. Although MongoDB/Classic has had import options for some time, the newer SSL-enabled, WiredTiger supporting MongoDB on Compose has, up until now, not had any import options.

After designing and engineering a reliable platform for running processes like imports, we can now offer MongoDB users the ability to import data from MongoDB Classic databases and the now unavailable Compose MongoDB sandboxes. This means if you want to move to the latest Compose MongoDB, it's all become a lot easier. The enhancements have also improved the experience for existing import support.

The database import options do just what they imply, import an entire database. That means all collections and recreating the indexes that were present in the source database.

To show you how it works, let's run through the process for moving data from a MongoDB Classic deployment to a freshly deployed MongoDB. The source of data for this is a deployment called sourcemongodb with a database within it called original and within that a collection called miscdocs. That's all the things we need to know as we start this process over on the destination deployment...

Overview Destination

We need a destination database to import into next. If you reuse an existing database, do be aware that the import process will first drop the entire database before beginning the import. As we are working with a fresh database, we click on Browser and enter a name for the database:

Database Use

This will take us on to the Browser view for that database. In the left hand menu bar, the Imports item is now available. Click on that to see this:

Browser Database

If we'd previously imported into this database, we'd see the past imports listed here, but this is a fresh database so our next stop is to click on the New Import button in the top right which takes us to the Imports/New page.

Imports New

The first option is to select whether you are importing from within Compose or from a remotely accessible MongoDB. If the Remote option is selected, you can enter a MongoDB URI (with username, password, host, port and database name) to import from an internet accessible MongoDB. We're importing within Compose, where things are simpler. The Deployment menu button will list all the deployments which are available for import, and which ones aren't. We'll select our source deployment in this menu sourcemongodb. Then we enter the database name in the following field. Once that's done click Import Database and you will return to the Imports view.

Imports Running

The import may take a short while to start; it will show Pending during that time and once ready, switch to, as we see here, Running. This page will automatically update as the import runs, showing when it started importing and where it's importing from, how long it has been running and current status. There's also a button to cancel the import. Finally, there's a button to display logs. Click that and you'll see something like this:


This is a textual record of log messages from the import process. Transient errors may be reported in this log so if the data being transferred is critical, this is our first step to validate it.

Depending on how much data there is to transfer, the import will eventually complete. If we go to our collections view, we'll see the sole collection (all 500,000 documents) imported:

Final View

Now you can see how you can mobilize your data around the Compose platform without leaving the Compose console. Go forth and import!

Dj Walker-Morgan
Dj Walker-Morgan was Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.