MongoDB

MongoDB - or Mon(single) “god”. They say it’s from the word humongous, but lets not be cute here. I never used a database before, and I’ve been saving my analysis to separate files (>50k of them infact).

Since searching, and retrieving was a headache, I built my own DB management system from scratch… Then the ‘you’re not a very good programmer’ realization came to me.

Over a couple hundred lines of code, and things get hairy with hackers. So lets keep it clean and leverage off people smarter than me.

To SQL or to not SQL, that is the question?

SQL was built before I was born, which means a lot of old people use it. It’s not cutting edge, and a bit boring, so I opted for Mongo.

On OSX (Lion at least?)

brew update
brew install mongodb

Then

 sudo mkdir -p /data/db/
 sudo chown `id -u` /data/db

Then (mongo Database, or single god, up to you)

mongod

Open a 2nd terminal and type:

mongo

Then to see if it works:

db.foo.save( { a : 1 } )
db.foo.find()
Sucess? I thought so. Now for Ruby Side...
sudo gem i mongo #this should install the bson dependent too
sudo gem i bson_ext #C extensions for speed