Playing around with mongodb
Posted: March 25th, 2011 | Author: Alex Braunstein | Filed under: mongodb | 1 Comment »In my first post on this blog, I set a goal of filling the holes in my tech education. Goals 4 and 5 were to play around mapreduce/hadoop for large scale data processing and gain MySQL knowledge. I decided to squish them both into one and try out mongodb, which is deployed at companies like shutterfly, foursquare, intuit, and others.
So lets start from scratch. Download the correct distribution here and untar it (your version number may be different):
tar xzf mongo.tgz
Now make a directory for the data, open a new terminal window in the same working directory, and start mongodb:
./mongodb-osx-x86_64-1.8.0/bin/mongod
If you see: Error: couldn’t connect to server 127.0.0.1 shell/mongo.js:79 its because you did ./mongodb-osx-x86_64-1.8.0/bin/mongo, which connects to an existing database, rather than ./mongodb-osx-x86_64-1.8.0/bin/mongod, which initializes one.
In your other open terminal do:
then you are good to start creating entries and querying.
db.foo.find()
Thats it. Also, here is a handy MySQL to mongodb conversion chart. I’m going to work on a fun and quasi-advanced stat function, but I’ll write that up in a separate post.
Inspiring! Downloading now as I write this.