Jonathan Birkholz

Learning Mongo DB and NoRM

I am currently working on a WPF application I will be using to manage our TFS system here at SolArc. Well it isn’t for everyone, just for me (for now). I look at the TFS interface and I can’t see what is important to me and doing the operations I want seems counter-intuitive. So what does a programmer do? He naturally writes an app for himself. :D

The problem I am running into is that although the WorkItems API is nice, it isn’t exactly what I want. I would rather not hit the SQL database as well. My current thoughts is to replicate the TFS workitems in a MongoDb. Naturally the WorkItems won’t be ‘workitems’ but will actually be the shape and correct context for how we use them. For example we have work item types for Epic Scenarios, Scenarios, and Tasks. Anyway the nuts and bolts of the app can be another blog post once I have something more concrete to share.

Since I am learning Mongo DB, I decided to write a post so that I will have something I can go back to when I inevitably forget how I got something to work.

I got MongoDB at http://www.mongodb.org/

Then in the bin folder I tried to run mongod. Unfortunately it failed because I had not created a data/db folder. That is the default location for MongoDB to store data files.

After creating the folders on the C:\ drive, I reran mongod and it started the database.

I heard a lot about NoRM at Open Spaces so I figured I would use that to work with the MongoDB.

I got NoRM at http://github.com/atheken/NoRM

The NoRM tutorials I found online were using a different code base so the way I connected to the database was a bit different. My first test looks like:

I am sure there are better ways of writing the tests, but I thought I would share the minimum test that I wrote to prove that NoRM and MongoDB were working.

I will be adding more learning tests and add them to the Learning_NoRM project in my Learning GitHub Repository.

http://github.com/RookieOne/Learning