Section: Backup and restore

Dump one database

bash
bash
mongodump --uri="mongodb://localhost:27017/appdb" --out=./dump
Explanation

`mongodump` creates a logical BSON dump that can later be restored with `mongorestore`.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Backup and restore
Dump one collection
Back up only a single collection.
OpenIn sheetbashsame section
Create a compressed archive dump
Stream a dump to a gzip archive.
OpenIn sheetbashsame section
Restore a dump and drop existing data first
Restore into a collection or database after clearing prior content.
OpenIn sheetbashsame section
Restore only selected namespaces
Restore a subset of data from a larger dump.
OpenIn sheetbashsame section
Check replica set status
Inspect members, state, and health.
OpenIn sheetjavascript1 tag match
Initiate a simple replica set
Initialize a replica set on a self-managed deployment.
OpenIn sheetjavascript1 tag match