1. 程式人生 > >is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface | mongodb在windows和Linux匯出出錯

is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface | mongodb在windows和Linux匯出出錯

執行mongoexport命令的時候

mongoexport --csv -f externalSeqNum,paymentId --host 127.0.0.1:27017 -d liveX -c consume_history -o 0531bill.csv -q '{"consumeStatus":"SUCCESS","externalSeqNum":/^201705/}'

報了異常

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