Robert Schultz

  • Archive
  • RSS

MongoDB: Intro

A while back I started reading into some of the NoSQL options for quick and dirty data storage. While there are plenty of them out there now days, I really liked MongoDB which serves as a document based NoSQL data store.

The beauty of this is that instead of thinking in a relational model, you store your data on a document level which is much more friendly to a programming if you ask me. For example, say you have an object like so:

var user = {
    “name”: “robert”,
    “age”:     31
};

First thing you notice is the syntax looks exactly like JavaScript, well that’s because it is. MongoDB document engine is built on top of JavaScript with a JSON type syntax called BSON; very cool. So that means you can already elverage your existing skill set at this point. Anyway, back to my point.

The awesome thing about this is instead of thinking in a relational mindset where if you had relational storage like a user and address you normally would have to create two tables. Since MongoDb uses a dynamic (or schema free) design there is absolutely no need to define this. Check out how easy this is:

var user = db.users.findOne({ “name”: “robert” });
user.address = {
    “street”: “1234 Street”,
    “city”   : “San Francisco”,
    “state” : “CA”
};
db.users.update({ “name”: “robert”}, user);

And that’s it. No modification of schema, no dropping tables and re-creating, nothing. Obviously this is a short example of the power of MongoDB but really shows the power of this sort of schema-less design.

I’m in no rush to run out and attempt to migrate all of our databases to a NoSQL approach but for things like logging, simple storage, statistics and so forth why not. By the way MongoDB supports replication sets and sharding automatically out of the box which makes scaling out horizontally a breeze.

One of the biggest advantages as far as performance goes is that MongoDB writes really, really fast. When doing writes to the database it’s basically an instantaneous write, where the client doesn’t wait from the server for a response, the response is essentially an “OK”. In my opinion this is why MongoDB is perfect for things that don’t need to have high availability with their data like when charging a credit card with the need for transactional support. It does support safe writes but this is another topic.

Since this is my new fascination I predict some more posts based on Mongo, my new love child.

    • #MongoDB
    • #NoSQL
  • 9 months ago
  • 26
  • Comments
  • Permalink
  • Share
    Tweet

Dreams of a Startup

While sitting idle tonight I started to think about if I was to launch my own startup from a fresh clean slate, what technologies and stacks would I use? Most people don’t get this opportunity so it’s actually a really interesting question to think about.

My first thought is being from a Microsoft background, would I want to go this route or learn something new. Using something like Python or Ruby would be fun don’t get me wrong, but in reality I’m wanting to launch a startup not spend my time learning new languages.  Even then, after being out of a super stealth mode this is completely appropriate and probably applauded.

So here’s my ideal architecture. I actually have some ideas brewing in my head so these are based on the needs of these ideas.

Fx

  • ASP.NET MVC3
  • C#
  • jQuery
  • Backbone

Storage

  • Redis for Session State
  • MongoDb for structured document data storage

Services

  • WCF

Events

  • NodeJs

Cloud

  • Amazon EC2
  • Amazon S3
  • Amazon SQS

IoC

  • Unity

Testing

  • nUnit
  • Selenium or Visual Studio Test Suite

In a nutshell the above is probably what I would begin focusing on and working with. It’s definitely a mixture of both Microsoft and non Microsoft technologies but I think that’s what makes things great; you shouldn’t lock yourself into one technology and should be flexible enough to adopt what’s best. I’m still probably need to update a few items here and expand reasoning but it’s a start. Also, I’m torn on the testing tools because honestly I think Microsoft’s suite of test tools that you can get with Visual Studio 2010 are not bad. It allows really nice integration but then again from what I understand, you need to use all of their tools to really make use of these components.

    • #Startup
    • #ASP.NET
    • #MVC
    • #MongoDb
    • #Backbone
    • #Redis
    • #WCF
    • #NodeJS
    • #AWS
    • #Unity
    • #nUnit
  • 9 months ago
  • 23
  • Comments
  • Permalink
  • Share
    Tweet

Portrait/Logo

About

I'm a software engineer at heart and living the dream. Currently a development manager at Ancestry.com working with an awesome team trying to build the next generation of web apps.

Me, Elsewhere

  • @robertschultz on Twitter
  • robertschultz on Soundcloud
  • robertschultz on Rdio
  • Google
  • Linkedin Profile
  • robertschultz on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr