Thursday, June 16, 2011

Optimizing MongoDb talk

There are a lot of good presentations from MongoNYC 2011 Conference. One of them that you can check out the slides from is: Optimizing MongoDb by Andrew Rollins. 




  One of the things you have to get used to about NoSQL is that its such a new topic that there aren't many resources out there for there - O'Reilly books, classes, etc. Its getting better all the time but its still a subject in its infancy. One great source of information you can tap into a couple times a year are the conferences that are put on for NoSQL. In fact, my first real exposure to the technology was at the NoSql East 2009 Conference. I highly recommend checking out the site for - its still got logs of relevant videos and slideshows showing how some of the biggest companies (Twitter, Facebook, Microsoft, etc.) are using NoSql to handle their needs.

Cheers,
TheSortedProgrammer

Tuesday, June 14, 2011

Mongo Db

I started working on a new pet project -  creating a blogging system using PHP and mongoDb. I have a keen interest in NoSQL and I've been wanting to get my hands dirty with mongoDb for sometime now and this seems like as good a project as any to put the db through its paces.

I thought I would document the process here until my new mongo powered blog is working.

So far so good - I installed the mongoDb with no problem and went through the start-up guide on the mongoDb site.

Next I installed the php half of the equation - MongoDB database driver for php.
Unfortunately I didn't have pecl installed on my new MacBook Pro -  Curses A Road Block!
Running the commands:
curl http://pear.php.net/go-pear.phar > go-pear.php
php -d detect_unicode=0 go-pear.phar
got me the pear/pecl packages I needed.

Now I just ran:
pecl install mongo
and boom I had the drivers installed. All that was left was to update the php.ini file and restart Apache.

As a final step I created 2 pages.
postCreator.php - a page with a form that allows the user to create a new blog entry and insert it (blog it) into their collection. The page creates mongo records that consist of a few fields (username, timestamp, title, text, label, etc.)
view.php - a page which displays the blog entries.

So thats where I've gotten to. All matters of formatting and style sheets have to be worked out. As well as a commenting system and lots of other issues. Still, I'm impressed by how quickly I was able to get up and running with mongoDb.

Cheers,
TheSortedProgrammer