views:

1366

answers:

3

I'm starting a hobby (non-revenue) project using Ruby on Rails. I've done a fair amount of development in Rails using Postgresql, and I can make a pretty good imitation of normalized schema. However, Mongrodb looks shiny and new. What better for trying out something new than a hobby project?

Think back to when you started using Mongodb. What techniques did you learn later that made you say, "If only I knew that when I started!" What plug-ins did you discover that you would have used right from the start, if only you had known? What references would you like to have had bookmarked?

+3  A: 

You should definitively take a look into junemakers mongo-mapper: http://github.com/jnunemaker/mongomapper But I also recommend you to play a little bit with the pure Ruby Mongo driver to see how mongo-mapper works under the hood. It isn't very hard to put some data into a Mongo database using Ruby.

I guess you already found the Ruby Mongo Tutorial. Just in case you didn't, here is the link: http://www.mongodb.org/display/DOCS/Ruby+Tutorial

t6d
Believe it or not, that wasn't in the links I've queued up to read, and it looks like a good one. Thanks.
Wayne Conrad
+11  A: 

I would definitely second the recommendation of MongoMapper if you're going to be using MongoDB with Rails. I will warn you, however, that there is (so far) no documentation other than a couple blog posts. If you're not comfortable digging into the source code to see how things work, it's probably not for you yet.

If you're working outside of Rails, I'd recommend staying away from MongoMapper. Because it's working MongoDB into something similar to what we expect from a SQL-backed ORM, it doesn't really give you a good idea of the power of and of the different thinking behind MongoDB. Spend some time playing around with the lower-level ruby driver, and even in the javascript console.

The other thing I'd recommend, especially since you mentioned knowing how to normalize a schema, is not to think of MongoDB as a database for now. The way you organize your data in MongoDB is very different that with a relational database. Try to think about it more as a place to store and retrieve Ruby hashes. You can do some relational things with MongoDB, but I'd recommend sticking with only self-contained documents while you're trying to wrap your head around NoSQL.

As for what links you should look at, I'd highly recommend reading through everything you can on the MongoDB site. Their documentation is very good. Particularly, take a look at the advanced queries, multikey indexes, and MapReduce to get an idea of some of the unique advantages and strengths of a NoSQL database.

Emily
This is exactly the sort of advice I was looking for. Thank you.
Wayne Conrad
+2  A: 

Here is a great beginner/introduction to MongoDb podcast from .NET Rocks -

http://www.dotnetrocks.com/default.aspx?ShowNum=507

Mike Dirolf is intereviewed... he works on the MongoDb project. Oh, and the sound quality is excellent.

Mike Dirolf is a Software Engineer at 10gen, where he works on the MongoDB project. He mainly works on client drivers for Python and Ruby, but also takes time out to talk about MongoDB - he has presented at EuroPython, Strange Loop Conf, RubyEnRails, RuPy and RubyConf as well as at meetup groups in New York City, London, Washington D.C. and San Francisco.

Kris Krause