Exporting and Restoring MongoDB Databases with `mongodump` and `mongorestore`
Backups are an important part of MongoDB administration. Two standard command-line tools for logical backups and restores are mongodump and mongorestore, which work with BSON data and collection metadata. 1. Back Up a Database with mongodump Use mongodump to create a BSON backup that can later be restored. Basic syntax: mongodump -d <database_name> -o <backup_directory> -d <database_name> → the database to back up. -o <backup_directory> → the directory where the dump will be written. Example: