Tuesday, July 02, 2013

Don't Fear the Mongo

NOSQL is a term that strikes fear in the heart of many with traditional relational database skills.

How can a database not use SQL?  How could that possibly perform well?  It does!  And it's not hard to learn, either. Don't worry about performance - just dive in.  http://education.10gen.com is offering free classes in Mongo - and the'yre totally worth your time.

I'm partially through "M101P MongoDB for Developers" and I now feel relatively comfortable addressing NOSQL related concerns.  I'm also enrolled in an upcoming "MongoDB for DBAs" class.

Similar to MySQL, MongoDB is a service process.  You connect using a client program, "mongo", or by using a MongoDB library and making calls from your favorite programming language.  The class I'm in right now uses python, which is pretty straightforward to learn - but they give you most of the python code for the various homework exercises already, and you only really need to write a few line of calls that use the MongoDB API for the various assignments.

If you know javascript and JSON notation, you're 80% of the way to knowing MongoDB already.  Here's a quick demo of using mongo:

bash-3.2$ mongo
MongoDB shell version: 2.4.4
connecting to: test
> show dbs
blog 0.203125GB
local 0.078125GB
m101 0.203125GB
students 0.203125GB
test 0.203125GB
> use students
switched to db students
> db.grades.find().forEach(  function(one){db.gradesCopy.insert(one)});
> db.grades.count()
600
> db.gradesCopy.count()
600
> quit()
bash-3.2$ 
Pretty straightforward, huh?   Don't fear the mongo!  

No comments:

Post a Comment