MongoDB is certainly one of the most popular open source, document-oriented NoSQL databases. Developed and maintained by 10gen, MongoDB is available in both a free version and a paid-for enterprise version, which adds features such as Kerberos security, SNMP access, and live monitoring features. However, neither the free version nor the enterprise version comes with a management GUI.
Sometimes, however, a GUI-based management console makes a welcome alternative. A graphical interface can display the components of a multidatabase server in hierarchical fashion, simplifying navigation through the database's elements. Put another way, with a GUI, you don't have to remember (or type correctly) the exact names of things. The GUI will figure them out, display them, and let you select them. In addition, a GUI's editing capabilities are typically more sophisticated than what's available at the command-line interface.
In this article, we'll examine four open source MongoDB GUI management tools:
RockMongo, a PHP-based application with a surprising array of features
phpMoAdmin, also written in PHP, based on a compact framework that reduces the footprint to a single PHP file
Genghis, a clean and straightforward GUI management console that has been released in both Ruby and PHP
I tested these management consoles on a small MongoDB cluster running in an array of virtual machines. I ran the applications on Windows 7 and Linux client systems, but they are all written in languages that allow them to run on any popular operating system.
Genghis: Clean GUI, PHP or Ruby
Genghis is unique in that versions exist for both Ruby and PHP. I had problems installing the Ruby version, which has many dependencies. Ultimately, I used the PHP version. It is a single file, and it can be launched from the command line to be executed within PHP 5.4's built-in Web server. Genghis's creator, Justin Hileman, assured me that the PHP version was identical to the Ruby version.
Launch Genghis in the PHP Web server and point your browser to the port you've selected as one of the command-line arguments -- there's Genghis. The PHP version's only external dependency is PHP's MongoDB driver.
Genghis's layout is sheer simplicity. Everything that isn't a BSON document is displayed in tables. Of course, the content of a given table depends on the level you're at. The top level is Servers. Click on a server from the displayed table of MongoDB servers and you drill down a level to databases. Click on an entry in the table of databases; down a level you go to collections. Select a collection and you come to the lowest level: documents.
All the while, Genghis displays a breadcrumb trail at the head of every page. With Genghis, you always know where you are. Hover over any element in the trail, and a pop-up shows overview stats at that level. For example, hover over a database item, and the pop-up shows a list of the databases on the server, plus the number of collections in each database.
The table at the server level shows the number of databases on each server, as well as the space consumed by the databases on that server. At the database level, the table displays a separate row for each database, with a column for the number of collections and a column for the space consumed by each database. Choose a collection, and the subsequent table shows the number of documents in the collection, the number of indexes, and the space consumed.
An Add button appears at each level for creating a new item at that level. For example, on the server level you'll find an "Add server" button (to add an existing server to Genghis's internal server list), on the database level an "Add database" button (to create a new database), and so on.
The rightmost column in every Genghis table is blank. Hover over any row in a table, and a red Remove button appears in that column. This is how you delete elements in Genghis. Move your mouse pointer to the rightmost column of a row in the collections table, click Remove, and you're prompted to remove the corresponding collection.
Many fields in Genghis's tables provide hover-over pop-up windows that display additional information associated with the field. Such fields are identified by dashed underscores. For example, hover over the Size field for a database, and the pop-up shows the average object size, the size of the data component of the database, the size of its index component, and the amount of storage space used by the database.
At the lowest level of object hierarchy in Genghis, the document level, Genghis abandons tables and displays BSON documents in what amounts to a vertical list of group boxes. This display appears when you choose a collection, and Genghis will paginate the documents so that only 50 are displayed at a time. (This number, unfortunately, is not configurable.)
Move your cursor into any document's text box, and Edit and Delete buttons appear in the upper-right corner. Delete is obvious. Click the Edit button, and the group box is converted to a text box, allowing you to modify the document's BSON.
You issue queries via a one-line text box at the top of the documents page. The query text box allows the shorthand of entering just a document ID to fetch individual documents. Alternatively, you can enter standard MongoDB BSON. Beneath the query text box you'll see three horizontal lines. Click those, and the text box expands from one line to five, allowing you to enter more complex queries. However, you can only enter query documents into this text box -- you cannot enter projection documents. In addition, the query text box doesn't handle the display of large queries very well. No scroll bars appear, so it's easy to lose the first and last line above or below the text box's upper or lower borders.
Finally, a drop-down menu next to the "Add collection" button lets you introduce a GridFS collection. Unfortunately, Genghis stumbled altogether at this point. Though we could create a GridFS collection, Genghis displayed "Unknown error" whenever we tried to upload a file into the collection. In addition, even though we could add files to the GridFS collection by other means, Genghis could not even open the fs.files collection. (When you create a GridFS file system in MongoDB, two collections are created. One stores the metadata information about the file including its name, its size, and so on. This is the fs.files collection. The other collection, called fs.chunks, stores the data of the file itself.) Trying to display the contents of fs.files, Genghis would simply lock up, displaying a never-ending progress bar.
Genghis at least deserves praise for its clean interface. But until the issues are ironed out and a bit more functionality is added, I would recommend Genghis only for performing basic MongoDB operations.
phpMoAdmin: Easy install, busy GUI
Obviously named after phpMyAdmin -- the well-known PHP-based GUI administration tool for MySQL -- phpMoAdmin is a single-file application. The entirety of phpMoAdmin resides in a solitary PHP file, moadmin.php. This, of course, makes it exceedingly easy to install. Just create a folder in your Web server's webroot directory, drop the moadmin.php file into it, and you're set.
Being in a single PHP file doesn't mean that phpMoAdmin is unconfigurable, however. Open moadmin.php, and you'll find various configuration options that can be enabled by uncommenting the lines that contain them. For example, by default, phpMoAdmin provides no user authentication. Uncomment one line, edit in an administrator name and password, and access authentication will be required when phpMoAdmin launches. You can also configure phpMoAdmin to use one of three display themes.
phpMoAdmin owes its slender size to its origina as a stripped-down version of the open source Vork Enterprise Framework , an MVC framework for building PHP Web applications. The full Vork Framework is about 500K, but the designers of phpMoAdmin whittled it down to less than 100K for phpMoAdmin. (The phpMoAdmin file itself is about 113K.) The designers chose the Vork Framework because, at the time of phpMoAdmin's inception, Vork was the only framework with integrated MongoDB support.
Start phpMoAdmin, and in the upper-left corner of the screen, you'll see a drop-down from which you can select one of the available databases that phpMoAdmin has found on the current host. (You can configure phpMoAdmin to connect to a server on a remote host, but you must modify the moadmin.php file to do that.) To the right of the drop-down is a "Change database" button, which you click to actually cause the database in the drop-down to become the current database on which operations can be performed.
Also in the upper part of the page you'll find links for "Repair database" and "Drop database," which act on the current database. You can tell which database is current because its name is displayed in an oversized font next to the "Change database" button. The Repair link will issue the repairDatabase operation on a database (recommended only in exceptional circumstances, because repairDatabase obtains a global lock on the database while it's doing its work). I was told by the phpMoAdmin team that the Repair capability is a holdover from the early days of MongoDB, when the database often became corrupted. The Drop link's function is self-evident.
You'll find no fancy graphical icons on any of the controls in phpMoAdmin. An object that can be edited will have the hyperlinked text [E] displayed adjacent to its name; adjacent to an object that can be deleted, you'll find a [X] hyperlink. So click the [E] link next to a collection's name to change that name. Click the [X], and you're asked if you really want to delete that collection.
Select a database, and phpMoAdmin displays a list of the collections in the database. Click on a collection, and you're shown the first 100 documents in the collection. (You can alter the number of documents displayed per page by editing the moadmin.php file, or by entering a value in the limit textbox that's displayed when you select a database.) The universal fast-forward and fast-reverse indicators (>>> and <<<) appear when the number of documents in a collection exceeds what can be displayed on a single page.
By clicking the "Show Database & Collection selection" link, you can combine the view of the current database and its collections plus the currently selected collection and its first 100 documents. This makes for a busy display and reveals one of phpMoAdmin's major weaknesses: You can easily become lost in it.
Once you've selected a collection, new links appear for operating on the collection:
Insert new object. Click this, and you're taken to a text box where you can enter a new document. You'll notice that the textbox is pre-filled with the text array(...), which tells you immediately that you have to use the PHP associative array syntax to specify the documents.
Show indexes. This selection displays those fields for which indexes are currently defined. It also provides a text box for defining a new index for the documents' fields. You can also create compound indexes, and you can specify whether each index component is ascending or descending on a per-field basis.
Export and Import. These options let you write or read the BSON text (as a *.json file) of database documents. The Export command will write out the results of the currently displayed query. Note that these commands process document definitions in BSON syntax, not the PHP associative array syntax.
Sort. The Sort menu item will allow you to choose a field and sort the displayed records by that field either in ascending or descending fashion.
Search. Not to be confused with the Query menu selection, Search lets you pick a single document field from a drop-down control and enter a search value. The result amounts to a find-if-equal query on a single document field.
Query. Choosing this menu item opens a text box that lets you enter complex query expressions. Note that you have to use the PHP associative array syntax. For example, to locate all documents for which the isMarried field is 1, you'd enter array("isMarried" => 1).
There is no mechanism for specifying a query's projection document, by which you can limit the result's fields. Also, anything entered in the Search selection (above) narrows the query such that only elements that match the search criteria will be queried.
Designs for custom missions can be emailed to ships.
In today's open source roundup: Cloudbooks threaten the popularity of Chromebooks. Plus: A review of...
Windows 10 officially launches this week, so if you’re going for an immediate upgrade from your Windows...
You don't need an expensive channel bundle to stay informed. These online alternatives cater to every...
Polyvore's site lets users search for clothing items and create themed collections
CEO is suspecting of illegally altering financial data
A "useless" liberal arts concentration could make you stand out in an IT career