MongoDB provides several ways of importing data to your Atlas cluster.
For Shared Deployments (M0, M2, M5):
While most of the options to migrate data are not available in shared tiers, you can still use the self managed-tools:
Mongodump/mongorestore
It’s worth clarifying that mongodump and mongorestore are command line tools that can be used with all instance sizes. Seeding with mongorestore involves performing a mongodump operation on the source cluster, then using mongorestore to load the data on the destination cluster. For examples of the connection URIs required for these tools, click the ellipsis (…) on your cluster in the Atlas UI and select Command Line Tools.
This migration method requires some downtime, as the source and destination clusters are not kept in sync while the dump and restore take place. The total amount of downtime required depends on factors such as the size of data being migrated and the network connection between your source cluster and Atlas.
Mongoexport/mongoimport
These tools allow you to import/export data from a JSON or a CSV file into an Atlas cluster. mongoimport uses strict mode representation for certain BSON types.
This migration method also requires downtime, which may depend on different factors such data size, network connection and cluster health.
For Dedicated Deployments (M10+ tiers):
Cluster to Cluster Sync:
Starting on MongoDB 6.0, Live migration is no longer available in Atlas deployments and we have introduced Cluster-to-Cluster Sync. While this tool is intended to connect MongoDB clusters and synchronize data between them you can also use it as a one way migration tool.
The mongosync utility creates a connection between MongoDB clusters and it can be used to make a connection between:
See cluster to cluster sync product overview for reference.
Live Migration:
Atlas’ hosted Live Migrate Service is available for replica set and sharded clusters migrations, and is the recommended option for M10+ instances.
Live Migrate enables you to migrate a source cluster to a cluster hosted on MongoDB Atlas from within the Atlas UI. Live Migrate keeps the source and destination clusters in sync while the migration is in progress. The only downtime associated with this operation is the time required to switch connection strings, assuming that your application has been tested to work with the MongoDB version running on Atlas.
Considerations
You cannot live migrate to/from a Shared tier? or shared cluster. Consider modifying your cluster to scale up to an M10+ instance.
You cannot live migrate over a VPC Peering connection. Consider migrating with mongomirror.
You cannot live migrate to a MongoDB Atlas version 6.0+ cluster. See available migration path. Consider using cluster to cluster sync instead.
See the Atlas Migration Readiness Checklist article before running a live migration.
Mongomirror
Mongomirror is a command line tool used by Atlas Live Migrate to perform migrations. In basic terms, the tool copies all data from a source cluster to a destination cluster, and continuously tails the oplog to ensure that both clusters are kept in sync until applications switch their connections over to Atlas.
As with Live Migrate, downtime is limited to the time required to switch connection strings. Unlike Live Migrate, mongomirror can be used with VPC peering connections as the process can be run within your own VPC.
Mongomirror does not support sharded cluster migrations.
Please also check below additional resources for data migration:
If you have further questions or concerns please do not hesitate to contact us via chat for assistance.