mongodb數據備份和讀取
下載mongodb數據工具,https://www.mongodb.com/try/download/database-tools,解壓到目錄中
用命令行進入此目錄,使用mongodump命令生成備份文件,例如備份本地test數據庫到d:\db目錄, 在db目錄會生成一個test文件夾: mongodump -h 127.0.0.1:27017 -d test -o D:\db
mongodump -h dbhost -d dbname -o dbdirectory
恢復test數據庫,示例: mongorestore -h 127.0.0.1:27017 -d test D:\db\test
mongodump -h dbhost -d dbname --dir