版权声明:转载注明博主:明天依旧可好;来源: https://blog.csdn.net/qq_38251616/article/details/83387039
第一步:
在cmd中进入mongodb的安装目录下的bin文件夹
C:\Users\zzz>cd C:\Program Files\MongoDB\Server\4.0\bin
第二步:
从MongoDB导出csv格式数据
mongoexport --host localhost --db IP_cool -c standby --csv -f ip,port,anony_type,address,test_count,success_rate -o C:\Users\kzb\Desktop\test\IP.csv
参数说明:
-host arg 主机
–port arg 端口
-u arg 用户名
-p arg 密码
-d arg 数据库
-c arg 集合
-f arg 字段名 逗号隔开
-q arg 查询条件 json格式
–csv 导出csv格式
-o arg 导出的文件名
最常用格式:
mongoexport --host 主机 --db 数据库 -c 集合 --csv -f 字段名 -o 导出文件名