Skip to content

rahmal/mongo-web

Repository files navigation

Introduction

Mongo Web Admin is a small Sinatra app that partially replicates Futon, CouchDB’s Web-based frontend. Futon is a simple clean GUI to CouchDB’s REST interface. This app is a modified version of Futon, making CouchDB’s web interface compatible with MongoDB.

Futon’s code is included, mostly as-is, and has only been modified where necessary. This project is an experiment to bring a fully featured web based frontend to MongoDB.

As NoSQL DB’s Mongo and Couch have a lot of similarities… but still have some fundamental differences, so I had to make some decisions to make it work. Those differences are listed in the “Issues & Compatibility” section of this document.

Requirements

  • Ruby (tested with ruby 1.8.7 / 1.9.2 on MacOS Leopard / Snow Leopard / Lion & Ubuntu 9.04)

  • Gems : sinatra, yajl-ruby, mongo, bson, bson_ext

To install gems:

$ sudo gem install bundler
$ bundle install

Installation

Hosted on Apache/Passenger

Run bundler:

$ bundle install

Add the following config to your httpd-vhosts.conf file:

$ sudo vim /etc/apache2/extra/httpd-vhosts.conf 	

<VirtualHost *:80>
  ServerName dev.mongodb.com
  DocumentRoot /path/to/your/projects/mongo-web/public
  ErrorLog  /path/to/your/projects/mongo-web/log/apache.error.log
  CustomLog "/path/to/your/projects/mongo-web/log/apache.access.log" common
  <Directory "/path/to/your/projects/mongo-web/public">
    AllowOverride all
    Options All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Add the following line to your hosts file

$ sudo vim /etc/hosts
127.0.0.1   dev.mongodb.com

Go to: dev.mongodb.com/index.html

From command-line as Rack App

Run bundler:

$ bundle install

Run Rack:

$ rackup -p 4567

Go to: localhost:4567/index.html

Features

Most of the features in Futon are not working here yet, however most of the database management activities are functional. If you just need, a tool for simple crud operations and data manipulation, or a development tool to give you a window into your data, then this.

  • Standard database management

    • standard CRUD operations for documents

    • creation/deletion/modification of documents

    • creation/deletion/modification of databases

  • Features not yet completed

    • DB configuration

    • Map/Reduce

    • Replication

Views

Mongo Web Admin replicates CouchDB’s views functionality with some notable differences:

  • views are stored in design documents in a special collection called “__design”

Issues & Compatibility

Databases and Collections

CouchDB does not have “collections”, all the documents are stored directly into “databases”. Mongo Web Admin sees mongo’s collections as databases with the following conventions :

  • mongo web’s db = “db_name/collection_name”

  • mongo web’s db list does not include mongo’s system collections nor the special “__design” collections

Document IDs

Mongo’s _id are typed… and it make it difficult use CouchDB’s REST interface as is with Mongo. The following conventions are used to try to guess the correct _id type from the string provided in the url.

  • if _id is made of numbers, tries to cast _id as a FixNum and falls back to a String if no result is found

  • if _id is a valid ObjectId tries to cast _id as a Mongo::ObjectID and falls back to a String if no result is found

  • else _id is considered as a String

This method is not 100% reliable, but I guess it should cover the most common situations

About

Web-based interface for MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published