Back up the specified library mongodump-h ip-d dbname-o dir//-h back with server ip-d followed by database name No then backup all libraries-o after specifying where to back up it is a directory
Back up all libraries mongodump-h Ip-o dir
Back up the specified collection mongodump-d mydb-c testc-o/TMP/TESTC//-c Specify the collection name
Export collection to JSON file mongoexport-d mydb-c testc-o/tmp/testc.json//-O followed by a file name
Recover all Libraries Mongorestore--drop dir///Where dir is the directory name for backing up all libraries--drop optional means to delete the previous data before recovering it is not recommended
Restores the specified library mongorestore-d mydb dir///-d The name of the library to be restored dir is the directory where the library was backed up
Restore collection mongorestore-d mydb-c TESTC Dir/mydb/testc.bson//-C followed by the collection to be restored the name dir is the path to the file where the makefile was generated when you backed up the MyDB library here is the path to the Bson file
Import Collection mongoimport-d mydb-c TESTC--file/tmp/testc.json
This article from "愺 Burgundy pounding his 豩" blog, declined reprint!
MongoDB Backup Recovery