mongo导出导入

导出例子:

mongoexport -d test -c test -q '{sn:1}' -o test.dat

导入例子:

mongoimport -d test -c students students.dat

导出excel:

mongoexport -d test -c user -q {gender:2} -f username,nickname --type=csv -o test.csv

导出数据库:

mongodump -h IP --port port -u userName -p pwd -d database -o dir

导入数据库:

mongorestore -h IP --port port -u userName -p pwd -d database --drop dir

--drop:先删除现有数据,然后恢复。

 

posted @ 2016-05-26 11:02  無限大  阅读(176)  评论(0编辑  收藏  举报