mongo export not working显示脏数据

时间:2016-11-05 04:08:44

标签: mongodb export

我收到了一堆excel数据,我首先通过在线工具转换为json http://oss.sheetjs.com/js-xlsx/

它很有效。

enter image description here 然后是转换后得到的示例json数据。

[
    {
      "status": "Active",
      "Folio #": "5.042E+11",
      "address": "13423 NW 5TH PL",
      "city": "PLANTATION",
      "Zip Code": "33325",
      "agent_name": "Carlos Gutierrez PA",
      "dom": "97",
      "dates_email_were_sent_on": "-",
      "listPrice": "290000",
      "offerPrice": "63.35",
      "Offer": "183710",
      "C. Offer": "0",
      "LU": "0",
      "C": "Y",
      "P": "N",
      "E": "Y",
      "A": "Y",
      "Agent Type": "Agent",
      "phone_no": "(305) 710-9655",
      "email_address": "Carlos@GGMiamiRE.com",
      "cell_phone": "999-999-9999",
      "comments": "-",
      "county": "-",
      "owner": "-",
      "last_date_email_sent_on": "11/4/16",
      "no_of_emails_sent": "1",
      "last_date_email_open": "-",
      "no_of_emails_open": "-",
      "last_date_call_was_made": "-",
      "call_priority": "-",
      "user_logged_in": "-"
    },
    {
      "status": "Active",
      "Folio #": "5.1427E+11",
      "address": "3709 WASHINGTON ST",
      "city": "HOLLYWOOD",
      "Zip Code": "33021",
      "agent_name": "Jeanne M. Towne",
      "dom": "3",
      "dates_email_were_sent_on": "-",
      "listPrice": "259000",
      "offerPrice": "63.35",
      "Offer": "164070",
      "C. Offer": "0",
      "LU": "0",
      "C": "Y",
      "P": "N",
      "E": "Y",
      "A": "Y",
      "Agent Type": "Agent",
      "phone_no": "(954) 234-7653",
      "email_address": "jeanne@gigimyway.com",
      "cell_phone": "-",
      "comments": "-",
      "county": "-",
      "owner": "-",
      "last_date_email_sent_on": "11/4/16",
      "no_of_emails_sent": "1",
      "last_date_email_open": "-",
      "no_of_emails_open": "-",
      "last_date_call_was_made": "-",
      "call_priority": "-",
      "user_logged_in": "-"
    }
]

我可以使用以下命令将此数据输入mongo:

mongoimport --db mean-dev --collection properties --jsonArray --file properties-testData.json

但是当我尝试导出数据时,我使用以下命令得到这个奇怪的数据,它甚至不包含键的值。

 mongoimport --db mean-dev --collection properties --drop --jsonArray --file export-mongo.json



{"_id":{"$oid":"581d50fa23cdd2c137a30526"},"{\"_id\":{\"$oid\":\"581d500123cdd2c137a3050c\"}":"{\"_id\":{\"$oid\":\"581d500123cdd2c137a30514\"}","status":"status","Folio #":"Folio #","address":"address","city":"city","Zip Code":"Zip Code","agent_name":"agent_name","dom":"dom","dates_email_were_sent_on":"dates_email_were_sent_on","listPrice":"listPrice","offerPrice":"offerPrice","Offer":"Offer","C. Offer":"C. Offer","LU":"LU","C":"C","P":"P","E":"E","A":"A","Agent Type":"Agent Type","phone_no":"phone_no","email_address":"email_address","cell_phone":"cell_phone","comments":"comments","county":"county","owner":"owner","last_date_email_sent_on":"last_date_email_sent_on","no_of_emails_sent":"no_of_emails_sent","last_date_email_open":"last_date_email_open","no_of_emails_open":"no_of_emails_open","last_date_call_was_made":"last_date_call_was_made","call_priority":"call_priority","user_logged_in":"user_logged_in"}
{"_id":{"$oid":"581d50fa23cdd2c137a30521"},"{\"_id\":{\"$oid\":\"581d500123cdd2c137a3050c\"}":"{\"_id\":{\"$oid\":\"581d500123cdd2c137a3050d\"}","status":"status","Folio #":"Folio #","address":"address","city":"city","Zip Code":"Zip Code","agent_name":"agent_name","dom":"dom","dates_email_were_sent_on":"dates_email_were_sent_on","listPrice":"listPrice","offerPrice":"offerPrice","Offer":"Offer","C. Offer":"C. Offer","LU":"LU","C":"C","P":"P","E":"E","A":"A","Agent Type":"Agent Type","phone_no":"phone_no","email_address":"email_address","cell_phone":"cell_phone","comments":"comments","county":"county","owner":"owner","last_date_email_sent_on":"last_date_email_sent_on","no_of_emails_sent":"no_of_emails_sent","last_date_email_open":"last_date_email_open","no_of_emails_open":"no_of_emails_open","last_date_call_was_made":"last_date_call_was_made","call_priority":"call_priority","user_logged_in":"user_logged_in"}

1 个答案:

答案 0 :(得分:0)

此命令有效。

mongoexport --jsonArray --db mean-dev --collection properties --out export-mongo.json