備份(導出)mongodb
1.導出單個collection-.json格式json
mongoexport --host:127.0.0.1 --port:27017 --db test --collection testcollection --out /xxx/testcollection.json
2.導出整個db的數據 --host 默認爲127.0.0.1 --port 默認爲27017rest
mongoexport --db test --out /xxx/
會生成一個dump文件夾文檔
恢復get
mongorestore --db accounts dump/io
官方文檔test