RockMongo是一個MongoDB管理工具,連接數(shù)據(jù)庫的時候,輸入 相應的地址用戶名和密碼就好了。點擊連接。通過 Rockmongo 你可以管理 MongoDB服務,數(shù)據(jù)庫,集合,文檔,索引等等。
它提供了非常人性化的操作。類似 phpMyAdmin(PHP開發(fā)的MySql管理工具)。
安裝需求
一個能運行PHP的Web服務器,比如Apache Httpd, Nginx ...
PHP - 需要PHP v5.1.6或更高版本,需要支持SESSION
為了能連接MongoDB,你需要安裝php_mongo擴展
快速安裝
下載安裝包,快速安裝。
用編輯器打開config.php,修改host, port, admins等參數(shù)
在瀏覽器中訪問index.php,比如說:http://localhost/rockmongo/index.php
使用用戶名和密碼登錄,默認為"admin"和"admin"
開始玩轉(zhuǎn)MongoDB!
創(chuàng)建數(shù)據(jù)庫文件的存放位置
在你安裝MongoDB的bin 目錄下打開cmd, 輸入:mongod 回車啟動服務。會看到:
Hotfix KB2731284 or later update is not installed. 以及 C:\data\db not found 的字樣。
這就涉及到了兩個問題了。先說第2個。
MongoDB默認數(shù)據(jù)庫文件夾路徑為C:/data/db(注:雖然是默認,但是需要你自己創(chuàng)建)。但也可以自己設置默認路徑,比如d:/test/data/db。啟動mongodb服務之前必須創(chuàng)建數(shù)據(jù)庫文件的存放文件夾,否則不能啟動成功。使用系統(tǒng)默認文件夾路徑時,啟動服務無需加 --dbpath 參數(shù)說明。如果不是默認路徑,則啟動服務格式有如下兩種:
(1)mongod --dbpath 存放的路徑。如:mongod --dbpath d:\test\data 【注:路徑不能包含空格,否則使用第2種】
(2)mongod --dbpath "存放的路徑" 。如 mongod --dbpath "d:\my text\data"
Robomongo連接遠程mongodb服務
備份還原數(shù)據(jù)庫
備份
mondump -o ./ #導出到當前路徑
恢復
mongorestore /home/zhangy/mongodb/ #這里的路徑是所有庫的備份路徑
Robomongo is now Robo 3T, with support for MongoDB 3.4, new data type NumberDecimal (Decimal128) and ECMAScript 2015 (ES6)
In this release, we have some fundamental changes such as MongoDB 3.4 support, new data type NumberDecimal support and ECMAScript 2015 (ES6) support. Fix for popular shell timeout problem (and shell timeout is configurable on UI now). Stability improvement: Fix to prevent an on-launch crash on macOS Sierra. Security improvement: OpenSSL upgraded to version openssl-1.0.1u (22-Sep-2016). Tool chain upgrades: Modern C++14 features are enabled and usable by developers.
robomongo 怎么導出數(shù)據(jù)
數(shù)據(jù)導出:先舉個例子作為切入口:
需求:
將test數(shù)據(jù)庫下的things集合中的所有文檔導出到D:\mongo_data路徑下
D:\mongo\bin>mongoexport -d test -c things -o d:\mongo_data\things.txt
cmd控制臺返回導出的相關(guān)信息,如下所示
connected to: 127.0.0.1
exported 15 records
檢驗一下:
去D:\mongo_data找一下是否存在things.txt文件
打開D:\mongo_data\things.txt顯示如下:
{ "_id" : 3 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55de" }, "x" : 6, "y" : 0 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55df" }, "x" : 6, "y" : 1 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e0" }, "x" : 6, "y" : 2 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e1" }, "x" : 6, "y" : 3 }
{
"_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e2" }, "add" : [ { "age" :
21, "name" : "jimvin" }, { "age" : 22, "name" : "jimvin" }, { "age" :
23, "name" : "jimvin" }, { "age" : 23, "name" : "jimvin" } ], "x" : 6,
"y" : 4 }
{ &qu緝伐光和叱古癸汰含咯ot;_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e3" }, "num" : 55, "x" : 6, "y" : 5 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e4" }, "age" : null, "num" : null, "......余下全文>>
;x" : 6, "y" : 6 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e5" }, "add" : [ "jimvin", "abc", "aaa" ], "num" : "abc", "x" : 6, "y" : 7 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e6" }, "age" : [ 7, 9 ], "name" : "jimvin", "num" : 20, "x" : 6, "y" : 8 }
{ "_id" : { "$oid" : "528ec3042e2ec9f2c3cd55e7" }, "age" : [ 7, 8, 9 ], "name" : "tom", "x" : 10, "y" : 9 }
{ "_id" : { "$oid" : "5296e6d68378a9afba69af46" }, "add" : { "age" : 20, "name" : "jimvin" }, "name" : "jim", "num" : 10 }
{ "_id" : { "$oid" : "529eab9552bf5eb74acdb35b" }, "name" : "person1", "addr" : { "city" : "a", "state" : "d" } }
{ "_id" : { "$oid" : "529eaba252bf5eb74acdb35c" }, "name" : "person1", "addr" : { "city" : "b", "state" : "c" } }
{ "_id" : { "$oid" : "529eabc352bf5eb74acdb35d" }, "name" : "person1", "addr" : { "city" : "a", "state" : "e" } }
從例子我們基本都能猜出 mongoexport的命令用法,下面我們再詳細分析一下:
* mongoexport --db
簡寫 mongoexport -d
指定要導出集合所在的數(shù)據(jù)庫
eg:
D:\mongo\bin>mongoexport --db test
或 D:\mongo\bin>mongoexport -d test
或 D:\mongo\bin>mongoexport -db test
注意: