KeyRef Progress Update

Here are the original mockups for KeyRef

select_app

view_shortcuts

and the implemented screens look like (apologies for the ugliness):

image

 

image

both the application search, and the shortcut search, are working.

I tweaked the application shortcuts page url, so now the url for visual studio shortcuts is:

http://localhost:3000/app/show/4c19e8a5cfbfb01794000001/Visual%20Studio-shortcuts

Also, I have a page for entering new shortcuts that looks like:

image

Now I can start adding shortcuts, which will be a big job. I’d like to get it online so that people can add shortcuts for their favourite applications.


Random MongoDb Syntax: Updates

I have a MongoDb collection called tweets. Each document has a property system_classification. If the value of system_classification is ‘+’ I want to change it to ‘positive’.

For a regular relational database the query would be:

update tweets
set system_classification = 'positive'
where system_classification = '+'

the MongoDb equivalent is:

 db.tweets.update({system_classification: '+'}, 
 {$set: {system_classification:'positive'}}, false, true)

 

Parameter Description

{ system_classification: '+' }

the first parameter identifies the documents to select

{ $set: { system_classification: 'positive' } }

the second parameter is an operation ($set) and the parameter to that operation {system_classification: ‘positive’}
false the third parameter indicates if this is a regular update or an upsert (true for upsert)
true the final parameter indicates if the operation should be applied to all selected documents (or just the first)

mongoDB Management Studio

This weekend I have been in Sydney at the MS Web Camp, learning about web application development. At the end of the first day we came up with application ideas and pitched them. My idea was to build a web management application for mongoDB.

mongoDB

I pitched my idea, put down the microphone, and then someone asked, “what’s mongo?”. Good question. MongoDB is a document database that stores JSON style documents. This is a JSON document for a tweet from twitter:

 db.tweets.find()[0]
{
        "_id" : ObjectId("4bfe4946cfbfb01420000001"),
        "created_at" : "Thu, 27 May 2010 10:25:46 +0000",
        "profile_image_url" : "http://a3.twimg.com/profile_images/600304197/Snapshot_2009-07-26_13-12-43_normal.jpg",
        "from_user" : "drearyclocks",
        "text" : "Does anyone know who has better coverage, Optus or Vodafone? Telstra is still too expensive.",
        "to_user_id" : null,
        "metadata" : {
                "result_type" : "recent"
        },
        "id" : {
                "floatApprox" : 14825648892
        },
        "geo" : null,
        "from_user_id" : 6825770,
        "search_term" : "telstra",
        "iso_language_code" : "en",
        "source" : "<a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a>"
}

A mongodb server can have many databases, each database has many collections (instead of tables) and a collection has many documents (instead of rows).

Development

Day 2 of the Sydney MS Web Camp was allocated to building our applications. First thing in the morning I identified the stories that I wanted to implement:

Scenario: View databases
Scenario: View Collections in a database
Scenario: View Documents in a Collection
Scenario: Delete a Collection
Scenario: Delete a Database
Scenario: Delete Documents

Over the course of the day the team (3.5 developers) implemented all of the planned stories (except ‘delete a database’) and also implemented the following:

Scenario: Create Database
Scenario: Create Collection

Lessons Learned

I’m new to MongoDB and in the past I have only accessed it from Ruby (for my hare-brained scheme). When it came to implementing our MongoDB management studio we discovered that their is no official MongoDB driver for .NET. We chose to use NoRM, honestly just because it was the only one I had heard of. NoRM was a challenge. I think it is a fine library but it is focused on mapping strongly typed objects to MongoDB. For our application we had no prior knowledge of the types that would be in the MongoDB database so NoRM was probably a poor choice.

Here are some screens (click to enlarge):

image image