备份数据(导出):
mongodump -h dbhost -d dbname -o dbdirectory
eg:mongodump -h localhost -d eportal -o ~/desktop
恢复数据(导入):
mongorestore -h dbhost -d dbname dbdirectory>
eg:mongorestore -h localhost -d eportal -o ~/desktop/neweportal
⚠️上述命令需要在根目录下运行,而不是在mongoDB命令行中