MongoDB資料匯出成CSV

來源:互聯網
上載者:User

標籤:mongodb


# articles

mongoexport -d mean-npbao -c articles --type=csv -f _id,type,title,author,brief,html,content,urls,client,created -o /root/hmg/articles.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,type -o /root/hmg/articles/type.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,title -o /root/hmg/articles/title.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,author -o /root/hmg/articles/author.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,brief -o /root/hmg/articles/brief.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,html -o /root/hmg/articles/html.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,content -o /root/hmg/articles/content.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,urls -o /root/hmg/articles/urls.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,client -o /root/hmg/articles/client.csv

mongoexport -d mean-npbao -c articles --type=csv -f _id,created -o /root/hmg/articles/created.csv


# clients

mongoexport -d mean-npbao -c clients --type=csv -f _id,uuid,name,icon,city,sex,created -o /root/hmg/clients.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,uuid -o /root/hmg/clients/uuid.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,name -o /root/hmg/clients/name.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,icon -o /root/hmg/clients/icon.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,city -o /root/hmg/clients/city.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,sex -o /root/hmg/clients/sex.csv

mongoexport -d mean-npbao -c clients --type=csv -f _id,created -o /root/hmg/clients/created.csv


# discusses

mongoexport -d mean-npbao -c discusses --type=csv -f _id,str,article,client,toClient,created -o /root/hmg/discusses.csv


scp /root/hmg.zip  [email protected]:/root

zip -r hmg.zip hmg/


select *

into outfile ‘/usr/local/mysql/rea_tpc1.TXT‘

fields terminated by ‘,‘ optionally enclosed by ‘‘‘‘

lines terminated by ‘\n‘

from `rea_tpc`;


本文出自 “熔 岩” 部落格,謝絕轉載!

MongoDB資料匯出成CSV

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.