Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Atlas migration

How to Back Up, Restore and Migrate a MongoDB Database

By Freedom251 Team · · 11 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use mongodump to create a BSON backup and mongorestore to load it. For a relatively small deployment (MongoDB Atlas defines this as under 300 GB) with an acceptable maintenance window, dump and restore is usually the simplest path. For a supported topology where downtime must be minimal, Atlas live migration is the preferred approach. Before either operation, verify topology, MongoDB and feature compatibility versions, credentials, network access, encryption, and a tested cutover plan.

What each MongoDB backup and migration method does

MongoDB Database Tools run from your operating system. mongodump reads databases and writes a binary BSON dump. mongorestore loads that dump, an archive, or standard input into a mongod or mongos instance. They are not MongoDB Shell commands: open a terminal, PowerShell session, or other operating-system command line to run them.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Best fit Downtime and consistency Important qualification
mongodump and mongorestore Relatively small self-managed deployments, including datasets under 300 GB when an extended application outage is acceptable Stop writes for a consistent dump; a replica set can continue writes while using --oplog, then replay them with --oplogReplay Tool runtime and storage requirements grow with the dataset. Do not assume the replica-set oplog procedure applies to standalone deployments or every sharded topology.
Atlas live migration A supported source topology when low downtime is the priority Designed to keep the source serving applications while Atlas copies data and tracks changes; perform a controlled final cutover Atlas documentation recommends this route when possible because it automates many tasks with the least downtime. Confirm that your source topology is supported.
Filesystem snapshots Large deployments where storage-level performance and coordinated capture matter Can provide a fast, coordinated image when taken according to MongoDB’s deployment requirements Requires appropriate storage access and a design that preserves consistency, especially for sharded clusters.
Managed cloud backups Resilient, scheduled protection for managed deployments and larger or sharded systems Provider-managed scheduling and retention can reduce operational work Atlas Free clusters do not include Atlas managed backups; Free-tier operators use tools such as mongodump and mongorestore.

The “under 300 GB” figure is an Atlas migration recommendation, not a hard capacity limit for the tools. Dataset size, indexes, disk throughput, network bandwidth, write rate, and the outage you can tolerate determine whether dump and restore is practical.

Decide before you run a command

Inventory the source

  • Topology: standalone server, replica set, or sharded cluster.
  • MongoDB major version and feature compatibility version (FCV).
  • Data volume, index volume, expected growth, and available space for the dump and restored copy.
  • Encryption configuration, including whether collections use Queryable Encryption or client-side field-level encryption.
  • Databases and collections that must be included, plus users, roles, validation rules, indexes, and application dependencies.
  • Write rate and the longest outage the application can tolerate.
  • Network route, firewall rules, TLS requirements, and destination connection policy.

Match the method to the risk

Choose dump and restore when a maintenance window is realistic and the source is small enough that copying and validating the data is operationally comfortable. Choose Atlas live migration for a supported topology when an extended outage is unacceptable. For a large or sharded deployment, evaluate filesystem snapshots or a managed backup service that can coordinate the entire deployment rather than treating each shard as an independent database.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Plan the cutover

A migration is not complete when the destination contains documents. Define when the application will stop writing, how you will change connection strings, who can approve the switch, how you will verify representative queries, and how long the original system and backup will be retained for rollback. Even an online copy requires a controlled final cutover so that writes are not split between destinations.

Prepare tools, accounts and access

Install a compatible Database Tools release

Install the latest stable MongoDB Database Tools release appropriate for the operating system and deployment. The current mongorestore documentation page identifies Database Tools version 100.19.1. Keep the tools version-compatible with the MongoDB deployment; if your server is on an older major release, check the release compatibility guidance before choosing a newer tool.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use least-privilege credentials

  • The source account must be able to read every database and collection being dumped.
  • A self-managed restore may use an account with the restore role, subject to the objects and options you are restoring.
  • For a restore into Atlas, the account must have the Atlas admin role required by the Atlas mongorestore procedure.
  • Store credentials outside shell history where possible, and use the deployment’s required authentication source and TLS settings.
  • Permit the source and destination network connections before starting. A valid username cannot compensate for a blocked route, firewall, or destination access policy.

Check encryption constraints

Record the source and destination encryption settings and key-management dependencies. The mongorestore tool cannot be used with collections that use Queryable Encryption or client-side field-level encryption according to the tool reference. Those collections require a migration method that supports their encryption model; do not begin a dump expecting the tool to restore them.

Back up a standalone server or replica set with mongodump

Option A: stop writes for the dump

Stopping application writes gives the simplest consistency boundary. Put the application in maintenance mode or otherwise prevent writes, then run a dump from an account that can read the required data:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
mongodump --uri="mongodb://USER:PASSWORD@HOST/?authSource=admin" --out="./mongo-dump"

Replace the connection values with those for your deployment. The output directory contains BSON data and metadata that mongorestore can consume. Keep the dump on storage protected by the same access controls and encryption policy as the database.

Option B: continue replica-set writes with the oplog

If writes cannot stop and the source is a replica set, include the operation log:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mongodump --uri="mongodb://USER:PASSWORD@HOST/?replicaSet=NAME&authSource=admin" --oplog --out="./mongo-dump"

The oplog records writes that occur while the dump runs. This option is a replica-set procedure; do not apply it automatically to a standalone server or assume it provides a transaction-consistent backup for every sharded topology. You still need a cutover pause later, because the destination must stop lagging before applications switch to it.

Protect and verify the dump

  • Restrict filesystem permissions to the backup operators and the restore process.
  • Encrypt the dump at rest and during transfer when required by your policy.
  • Record the source host, MongoDB version, FCV, dump start and end times, and the exact command options.
  • Check that expected database directories and BSON files exist and that the destination has enough free space.
  • Perform a test restore into an isolated environment before relying on the dump for disaster recovery.

Restore a BSON dump with mongorestore

Restore to a self-managed MongoDB deployment

Start the destination at a compatible MongoDB major version and FCV. Then run mongorestore from the operating-system command line, not from MongoDB Shell:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
mongorestore --uri="mongodb://USER:PASSWORD@DESTINATION/?authSource=admin" "./mongo-dump"

The tool loads the BSON dump into the destination. If the backup was created with mongodump --oplog, replay the captured operations after the data files are restored:

mongorestore --uri="mongodb://USER:PASSWORD@DESTINATION/?authSource=admin" --oplogReplay "./mongo-dump"

Use --oplogReplay only with a dump that contains the appropriate replica-set oplog data. Replaying an unrelated or incomplete oplog does not make a restore consistent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restore into Atlas

Confirm that the destination cluster is running a compatible MongoDB major version and FCV, that your client can reach it, and that the restore account has the Atlas admin role required for mongorestore. Supply the Atlas connection string and the dump path using the same command-line pattern. Atlas Free clusters do not provide Atlas managed backups, so a Free-tier recovery plan relies on externally retained dumps and a tested restore procedure.

What a restore does not automatically solve

  • Users and roles are not migrated by the Atlas seeding workflow; create destination identities and grant the required privileges before application cutover.
  • Applications still point to the old connection string until you change configuration and deploy it.
  • Indexes, validation rules, and representative query behavior must be checked on the destination rather than assumed from a successful command exit.
  • Encryption keys and external key-management access must be available to the destination.

Move a database to Atlas with low downtime

Prefer live migration when the topology is supported

Atlas documentation recommends live migration when possible because it automates many tasks with the least amount of downtime. Use it when your source topology meets Atlas’s current support requirements and when the business cannot accept the extended outage associated with a large dump and restore.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
  1. Inventory the source topology, MongoDB version, FCV, data size, encryption, and write rate.
  2. Confirm Atlas connectivity and create the destination cluster at a compatible version and size.
  3. Configure the required network path and credentials so the migration service can read the source and write the destination.
  4. Start the live migration and monitor the initial copy and change synchronization.
  5. Prepare destination users, roles, secrets, indexes, validation behavior, and application configuration while synchronization continues.
  6. Schedule a short cutover window. Stop or quiesce application writes, wait for the destination to catch up, validate critical queries, and switch connection strings.
  7. Resume writes only on Atlas. Keep the source and the pre-migration backup until the recovery policy allows retirement.

Use dump and restore for an Atlas seed when downtime is acceptable

For a relatively small dataset (under 300 GB in the Atlas recommendation) and an application that can remain offline for an extended period, create a dump, restore it into Atlas, validate it, and then switch the application. Atlas migration documentation warns that writes issued after mongodump completes are not migrated by this seeding approach. Therefore, stop writes before the final dump or use a supported live-migration workflow instead.

Do not confuse mongoexport with a database backup

Atlas migration guidance limits mongoimport and mongoexport to small datasets for testing or development in the described workflow. They exchange collection data rather than preserving a complete database backup in the way mongodump and mongorestore do. They are not the default choice for a production migration that must retain database structure and metadata.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Version compatibility and feature compatibility version

A dump is not a promise that every destination version can accept it. Restore into a compatible MongoDB major version and verify FCV before loading data. A destination that is older than the source, or whose FCV cannot represent source features, can reject data or produce an unusable application environment.

  • Record the source and destination major versions and FCV before the operation.
  • Use a Database Tools release appropriate to those versions.
  • Restore into a staging destination first and exercise indexes, validators, users, roles, transactions, and representative queries.
  • Only upgrade or change FCV after confirming application and driver compatibility.

Sharded clusters require coordinated protection

A sharded deployment is more than several independent MongoDB servers. A dump taken from individual shards without a coordinated consistency boundary can produce a state in which related operations do not line up across shards. For sharded clusters, use a coordinated backup method that preserves transaction atomicity across shards, such as an appropriately designed filesystem snapshot or managed backup capability. If the selected migration workflow has explicit sharded-cluster support, follow that workflow rather than adapting the replica-set --oplog recipe.

Validate before and after cutover

Destination validation checklist

  • Expected databases, collections, document counts, and sample documents are present.
  • Required indexes exist and have the expected definitions.
  • Validation rules, collection options, and time-series or capped-collection behavior match the source where applicable.
  • Destination users and roles can authenticate and perform only their intended operations.
  • Encryption and key-management integrations work from the destination environment.
  • Representative reads, writes, aggregations, transactions, and background jobs succeed.
  • Application connection strings, DNS, secrets, firewall rules, and TLS settings target the destination.
  • Monitoring, alerting, backups, retention, and restore procedures are enabled for the destination.

Cutover sequence

  1. Announce the maintenance window and pause new application writes.
  2. For a live migration, wait until the destination reports that it has caught up; for a dump restore, complete the restore and any required oplog replay.
  3. Run the validation checklist against the destination.
  4. Change the application connection configuration and deploy or reload it.
  5. Confirm new writes appear only on the destination and monitor errors, latency, and replication health.
  6. Retain the source and backup according to the recovery policy before decommissioning anything.

Common failures and how to recover

Authentication or authorization errors

Confirm the authentication database, username, password handling, and required roles. The source needs read access; the destination needs restore privileges. For Atlas, verify the account has the Atlas admin role required by the procedure. Avoid solving a narrowly scoped failure by granting unrestricted access permanently.

Connection and network errors

Test DNS, routing, firewall rules, TLS certificates, and destination access policies from the machine running the tool. A restore cannot begin until that machine can establish the database connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Version or feature errors

Compare source and destination major versions and FCV, then test with a staging restore. Queryable Encryption and client-side field-level encryption collections cannot be restored with mongorestore; use a compatible migration design for those collections.

Missing recent writes

With a plain dump, writes made after the dump’s consistency point are absent. Repeat the dump with writes stopped, use a replica-set dump with --oplog and restore with --oplogReplay where applicable, or choose Atlas live migration. In the Atlas seeding workflow, writes issued after mongodump completes are specifically not migrated.

Sharded data is inconsistent

Stop treating shard-level dumps as a single backup. Re-evaluate the procedure and use a coordinated backup that preserves cross-shard transaction atomicity.

The tool is unavailable in MongoDB Shell

Exit the shell and run mongodump or mongorestore in the operating system’s terminal. Installing the Database Tools separately is expected.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a backup policy after the migration

A one-time dump protects only one point in time. Decide how often backups run, how long they are retained, where copies are stored, who can restore them, and how often a restore drill is performed. Keep at least one copy isolated from the production credentials and failure domain. For larger or sharded deployments, weigh the operational cost of tool-based dumps against coordinated filesystem snapshots or managed cloud backups. Revisit the plan whenever MongoDB versions, FCV, encryption, topology, or application write patterns change.

Practical decision summary

  • Choose mongodump and mongorestore for a small, self-managed deployment when you can schedule downtime and have tested the restore.
  • On a replica set that must keep accepting writes during the dump, use --oplog and restore with --oplogReplay, then perform a controlled cutover.
  • Choose Atlas live migration for a supported topology when minimizing downtime matters more than the simplicity of a maintenance-window restore.
  • Use coordinated snapshots or managed backups for large or sharded systems where tool performance or cross-shard consistency is the primary concern.
  • Regardless of method, verify permissions, network access, encryption, credentials, version compatibility, indexes, users, roles, and application behavior before switching production traffic.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Atlas migrationDatabase Backupdatabase migrationMongoDBmongodumpmongorestorereplica setssharded clusters

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.