1.导出数据指定数据库
3.导出数据库
4.导入数据库
5.导入数据指定数据表
./mongoexport -h localhost:40000 -u siteRootAdmin -p=123456 --authenticationDatabase admin -d db -c Terminal -o /tmp/terminal.dat
2.导出查询后数据
./mongoexport -h localhost:40000 -u siteRootAdmin -p=123456 --authenticationDatabase admin -d db -c ratableHistory -q '{"userCode" : /bd@163/}' -o /tmp/terminal.dat
3.导出数据库
./mongodump -h localhost:40000 -u siteRootAdmin -p=123456 --authenticationDatabase admin -d db -o /tmp/datacopy
4.导入数据库
./mongorestore -h localhost:40000 -u siteRootAdmin -p=123456 --authenticationDatabase admin -d db /tmp/datacopy/db/
5.导入数据指定数据表
./mongoimport -h localhost:40000 -u siteRootAdmin -p=123456 --authenticationDatabase admin -d ocsdb -c collection /tmp/test.dat
-h:指明数据库宿主机的IP
-u:指明数据库的用户名
-p:指明数据库的密码
-d:指明数据库的名字
-c:指明collection的名字
-f:指明要导出那些列
-o:指明到要导出的文件名
-q:指明导出数据的过滤条件