初学Mongdb,想用Mongoexport将Mongodb中的数据导出为csv。
执行指令:
mongoexport --host XXX --port XXX --collection students --db production --type=csv --out C:\student.csv
一直报错:no reachable servers,找不到服务器。
将指令修改为:
mongoexport -h XXX -pXXX -d production -c students--type=csv -f _id,TYPE,NAME --out C:\student.csv
成功导出数据!
目前猜想是否Mongdb版本原因,--host这类全拼指令在某些版本上不支持。(待考证,仅供参考!)