<div class="htmledit_views" id="content_views">html
<p>執行mongoexport命令的時候</p> <p><span style="background-color:rgb(255,255,255);"><span style="font-family:'PT Sans', sans-serif;font-size:16px;line-height:26.4px;">mongoexport --csv -f externalSeqNum,paymentId --host 127.0.0.1:27017 -d liveX -c consume_history -o 0531bill.csv -q '{"consumeStatus":"SUCCESS","externalSeqNum":/^201705/}'</span><br></span></p> <p><span style="font-family:'PT Sans', sans-serif;font-size:16px;line-height:26.4px;background-color:rgb(255,255,255);">報了異常</span></p> <p><span style="background-color:rgb(255,255,255);">is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface</span></p> <p><span style="background-color:rgb(255,255,255);"><br></span></p> <p><span style="background-color:rgb(255,255,255);">去掉-q和過濾條件是沒有問題的,那麼問題就出在過濾條件上</span></p> <p><br></p> <p><span style="background-color:rgb(255,255,255);">後來發現是window和linux的區別,linux上執行是外面包單引號,window要外面包雙引號</span></p> <p><span style="background-color:rgb(255,255,255);"><br></span></p> <p><span style="background-color:rgb(255,255,255);">window寫錯:</span><span style="color:rgb(235,209,183);font-family:'PT Sans', sans-serif;font-size:16px;line-height:26.4px;background-color:rgb(54,49,44);">"{'consumeStatus':'SUCCESS','externalSeqNum':/^201705/}" 就沒有問題了</span></p> <p><br></p> </div>linux
轉自:https://blog.csdn.net/dzl84394/article/details/72879795json