Importing a MongoDB Database

The import tool moves the data from another MongoDB database into the current database. It overwrites all data and indexes in the current database with the imported data. It can be used to move data from another database in the same deployment, a database from a different deployment, or an external database.

📘

MongoDB Classic Users

The Import tool can be used to migrate your Mongo Classic databases into a new-style Compose MongoDB.

The Import Tab lives in the MongoDB Data Browser of your MongoDB deployment. Click on the database that you want to import data into.

The Imports Tab

Any past imports to the current database are listed here, along with the source database, source deployment, status of the import operation, how long the operation took, and a link to logs for the import. If you need to re-run the import, there is a Rerun button on the right. If an import is rerun, it will overwrite any changes to the data in the current database that may have occurred since the previous import operation.

2440

The Imports Tab

To create a new import click on the New Import button in the upper-right.

2468

Creating a new Import

Importing a MongoDB Classic database

If you are migrating from a MongoDB Classic deployment to a new Compose MongoDB deployment, select the Compose option to Import From. Select the Classic deployment the source database lives in from the Deployment drop-down. Enter the name of the source database in the Database field.

Optional - Enable Tailing.

Click the Import Database button to begin the Import.

Importing a current Compose MongoDB database

If you are migrating a database from another Compose deployment (or a different database in the same deployment), you will have to first figure out if you want to use tailing.

Without Tailing

Select the Compose option to Import From. Select the deployment the source database lives in from the Deployment drop-down. Enter the name of the source database in the Database field.

Click the Import Database button to begin the Import.

With Tailing

You can use the Tailing option if you have an oplog portal configured on the source deployment. Select the Remote option to Import From.

Enable Tailing, and enter the information for the source deployment's oplog portal and the source database in the Enter a MongoDB URI field.

Click the Import Database button to begin the Import.

Importing an non-Compose MongoDB database

If you are importing a database from an externally running MongoDB, select the Remote option to Import From. Then enter the URI of the source database, and select if you would like to enable Tailing.

Click the Import Database button to begin the Import.

Tailing

When tailing is enabled, changes to the source database are replicated to the current database after the import of existing data is finished.

The import starts up and the imports status will say "Starting". While the import is running, you can keep your applications writing to your old deployment and the status is updated to "Running".

Then, when the import is complete and tailing starts, the status is updated to "Tailing". You can stop connections on your old deployment and switch your apps to use the new deployment when there is a convenient window for your applications.

Tailing will run until you stop it or for 3 days. Once you stop the tailing, or if it times out after the 3 days, the status will be "Cancelled".