利用mongoexport 可以将mongoDB里的数据导出csv或者json文件
-h arg 主机
--port arg 端口
-u arg 用户名
-p arg 密码
-d arg 数据库
-c arg 表名
-f arg 字段名 逗号隔开
-q arg 查询条件 json格式
--csv 导出csv格式
-o arg 导出的文件名
例如:
mongoexport -h 127.0.0.1:27017 -d test -c detail --type=csv -f _id,detail -o test.csv
就是到处数据库test种collections是detail的表中,_id和detail字段的信息倒出到test.csv文件