An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

MongoSF 2011

May 24, 2011 ·

I spent today at the MongoDB conference in San Francisco. World Singles is evaluating a number of noSQL data stores for some upcoming enhancements to our platform so we've already been playing around with Cassandra and Neo4J. The MongoSF 2011 conference was a good opportunity to take a good look at MongoDB as well as talking to other people who are using it.

I was very impressed at how many tracks the conference had (six) and the wide variety of technologies catered for in the languages track (.NET/Azure, Python, C#, C++, Java, more Python, Ruby, PHP). But no Clojure. Sigh. Fortunately, there's a nice Clojure wrapper called congomongo so during the first session - a whirlwind tour of MongoDB showing what it takes to build a simple FourSquare-style web application - I downloaded MongoDB and set up a Clojure project with congomongo so I could play along.

Several sessions covered case studies of development with MongoDB or switching to MongoDB from other technologies and I was blown away by the scale and performance everyone was claiming, as well as the general ease of use!

One of the more interesting vendors / sponsors present was MongoLab who provide MongoDB in the cloud on EC2 and Rackspace as a hosted service. They were also offering a chance to win an iPad to anyone who signed up for their service and created some specific data on their system. That was a good opportunity to try out some Clojure! I signed up for their free service and created a database and a collection and saved some documents there. Here's all it takes in Clojure to retrieve the data (hostname, port and credentials changed to protect the innocent!):

user=> (use 'somnium.congomongo)
nil
user=> (def db (make-connection 
                 "dbname" 
                 { :host "host.mongolab.com" :port 27123 }))
#'user/db
user=> (authenticate db "dbuser" "secret")
true
user=> (with-mongo db 
         (fetch :collection 
                :where { :email "sean@corfield.org" }))
({:_id #<ObjectId ...>, :first-name "Sean", :last-name "Corfield",
  :email "sean@corfield.org", :phone "(904) 302-7326",
  :company "World Singles, LLC", :blog "http://corfield.org"})
user=> (close-connection db)

Inserting and updating data is equally simple and congomongo also has support for manipulating indices, databases, collections, gridFS files and map/reduce. I think we're going to enjoy using MongoDB and Clojure...

Tags: clojure · mongodb

1 response

  • 1 Peter Bell // Jun 5, 2011 at 11:28 AM

    I just started working with Mongo recently and I've been surprised just how easy it was to get up and running.

    I also got introductions to a couple of people in the community solving similar problems from the team at 10gen and even took advantage of their "office hours" to get some free consulting on data modeling in Mongo.

    I've been consistently surprised by how easy to use the tech has been and how supportive 10gen has been. Looking forward to using it more seriously as our primary data store at SKiNNiO.