Backing Up and Restoring Data
Last updated
Last updated
Atlas backups are not available for M0 (Free Tier) clusters. You may use to back up your M0 cluster data and to restore that data. To learn how to manually back up your data, see .
Atlas provides instructions for connecting to an Atlas cluster using select MongoDB command line tools in the Command Line Tools tab.
Navigate to the Clusters page for your project.
Choose Command Line Tools for your desired cluster.
Download the CLI for Ubuntu/Debian and put the .deb file in your home directory.
Execute the following to install it: sudo dpkg -i mongocli_1.16.0_linux_x86_64.deb
Also install mongo-tools with sudo apt install mongo-tools
mongodump | creates a binary export of the contents of a database
--forceTableScan
is there because of an error, Unrecognized field 'snapshot'
. Solution was to include this parameter. See: https://dba.stackexchange.com/questions/215534/mongodump-unrecognized-field-snapshot
-o
is the target directory
The mongorestore program loads data from either a binary database dump created by mongodump or the standard input into a mongod or mongos instance.
Delete the preview database (it will be recreated automatically in the next step). Execute the following commands to recreate the preview database and restore each collection.
mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.
mongoexport --uri="mongodb+srv://<user>:<password>@cluster0.cwrqa.mongodb.net/rm_preview" --collection=documents --out=documents.json --forceTableScan --pretty
The mongoimport tool imports content from an Extended JSON, CSV, or TSV export created by mongoexport, or potentially, another third-party export tool.
mongoimport --uri="mongodb+srv://<user>:<password>@cluster0.cwrqa.mongodb.net/rm_preview" --collection=documents --file=documents.json
See:
See: