is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface

执行mongoexport命令的时候

D:\Program Files\MongoDB\Server\4.0\bin>mongoexport.exe -h localhost:27001 -d mldn -c emps -q '{age:{$gt:20}}' -f name,age,job,salary --type=csv > emps1.csv
2018-09-10T10:49:06.005+0800    error validating settings: query '[39 123 97 103 101 58 123 36 103 116 58 50 48 125 125 39]' is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
2018-09-10T10:49:06.015+0800    try 'mongoexport --help' for more information

报了异常

is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface

去掉-q和过滤条件是没有问题的,那么问题就出在过滤条件上

后来发现是window和linux的区别,linux上执行是外面包单引号,window要外面包双引号

window写错:"{'consumeStatus':'SUCCESS','externalSeqNum':/^201705/}" 就没有问题了

版权声明:本文转载自https://blog.csdn.net/dzl84394/article/details/72879795

你可能感兴趣的:(#,NoSQL数据库,mongodb导出)