Continuing the URL shortener sample from thesse post:
part I and
part II, I'll go from (stupidly) storing the shortened URLs in a static variable, as was the case in the code in
part I, to storing the shortened URLs in
MongoDB. The reasons for choosing MongoDB for persistence in this sample (compared to the "traditional" NHibernate + SQL Server approach) are:
- We will only store and retrieve one document at a time. Those are atomic operations in Mongo, so as far as this sample goes Mongo is fully consistent.
- Mongo is simple to setup, and very simple to code against. For instance there is no O/R mapping layer at all.
In summary, Mongo is a nice frictionless option for this sample.
Enough