采用官方工具導出mongo資料為json格式
可以遠端導出,隻要有host:port即可。
首先需要安裝tools:
在redhat中:
Create a /etc/yum.repos.d/mongodb-org-3.2.repo file so that you can install MongoDB directly, using yum.
一共有以下幾種選擇
mongodb-org
A metapackage that will automatically install the four component packages listed below.
mongodb-org-server
mongodb-org-mongos
mongodb-org-shell
mongodb-org-tools
如果全部安裝:
sudo yum install -y mongodb-org
如果隻安裝tools
sudo yum install -y mongodb-org-tools
-h host:port
--db db
-c collections
-q query string,查詢文法
-f 選擇導出字段
-o 導出檔案
--jsonArray 導出為數組,預設為{}{}{}...
唯有不斷學習方能改變!
-- <b>Ryan Miao</b>