How I Scrapped MySQL for MongoDB in Three Hours

Mike Borozdin, August 15th, 2011

MongoLabLast weekend at the AT&T Mobile Hackathon I had a pleasure of checking out the MongoLab’s MongoDB service.  In short: it was a delight to work with.  I fell in love with that technology.  It worked exactly the way I thought–MongoDB architects got it right. After spending a good part of the day fighting my hibernate configuration in JUnit I was pleasantly surprised when I saw that Mongo keeps their documentation and design accessible with plan old object and simple REST calls to its MongoLab API.

MongoLab makes creating a MongoDB super easy.  You can sign up for a dev account and within minutes get an instance that will hold up to 240MB of data.  It’s perfect for a prototype. In 15 minutes I was up and running and had my unit test executing flawlessly. It took a couple of more hours to refactor the application to move my serialization from MySQL + Hibernate to MongoDB.  In a total of three hours the port was complete.

The web interface on MongoDB made it easy to see if my app was serializing data correctly.  I created one collection for Unit Test and another collection for my production data. Collections can be limited in the number of records so they wouldn’t flood my account with test data.

MongoLab Admin View

Working with Mongo right after working with Hibernate and MySQL made me realize something.  In 2000-2007 we built up some complicated protocols and frameworks. The last couple of year the simplicity seems to have taken off.  A lot of people wrote off Java because of the complexities, but I can tell you that Spring+Annotations and MongoDB brings the joy back to Java web development again.

7 Responses to “How I Scrapped MySQL for MongoDB in Three Hours”

August 15th, 2011
at 11:32 pm
Comment by: EllisGL

I want to love MongoDB, but there are several issues I have with it.

1.) Security. You can password protect against writes, but you can read with out having authed against it.

2.) No built in joins, you have to do this external. You can do with CouchDB.

3.) No Master/Master replication. Only Master/Slave.

August 16th, 2011
at 12:50 pm
Comment by: Mike B.

are you sure you can read without a password? It seems like there is a password on connection in my tests. I assumed that prevents reads and writes.

Have you tested the version deployed by MongoLab?

August 16th, 2011
at 10:38 pm
Comment by: Will Shulman

You need to authenticate to read or write.

August 19th, 2011
at 10:52 am
Comment by: InfiniteGraph Wants You to Connect the Dots and Win Big Prizes

[...] databases are all the rage these days. We recently discussed moving from MySQL to MongoDB within hours. The rise of NoSQL is often associated with the need to not just store large amounts [...]

August 20th, 2011
at 6:57 pm
Comment by: Links for August 16th through August 20th — Vinny Carpenter's blog

[...] How I Scrapped MySQL for MongoDB in Three Hours – I can tell you that Spring+Annotations and MongoDB brings the joy back to Java web development again [...]

August 21st, 2011
at 8:01 am
Comment by: 45 New APIs: MongoDB, Podcast Retrieval, Skyscanner

[...] week we had 45 new APIs added to our API directory including a hosted MongoDB database, live chat platform, fact sharing service, podcast retrieval service, distributed graph database, [...]

August 26th, 2011
at 7:49 am
Comment by: Java Technologies Hibernate 4 Projects |

[...] How I Scrapped MySQL for MongoDB in Three Hours (programmableweb.com) [...]

Leave a Reply

  1. (not published)

Become a ProgrammableWeb Sponsor

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.