Over a million developers have joined DZone.

Why I Chose RavenDB for My Startup

· Database Zone

Learn NoSQL for free with hands-on sample code, example queries, tutorials, and more.  Brought to you in partnership with Couchbase.

In fact it was a decision which took no consideration at all: having worked with RavenDb on the inside and from the outside, it was my immediate choice. Here’s why.

RavenDb stays out of the way

RavenDb is like a waiter at the best kind of restaurant. It serves your data with the minimum of fuss and gets out of the way. Unlike certain persistence technologies I could mention, there is barely any configuration involved, and not a mapping in sight. You just hand RavenDb an object or any shape or size, and RavenDb stores it. You murmur an object’s id, and RavenDb has it on your plate in an instant, child collections and all.

RavenDb is a document database. That means that you don’t need to declare a schema upfront. Whenever you hand RavenDb an object it simply serializes it to JSON format, and stores it as a blob in its persistence engine. The benefit I see from this is greatly reduced pain when deploying updates to my code, as I won’t need to worry about sql migration scripts. I can add things to my objects with impunity, and for other situations, RavenDb has very nice document patching support.

As as you’d expect, given RavenDb’s provenance, the RavenDb .Net client is awesome. It has full support for the unit-of-work pattern and transactions. Thus any entities you load within a session are tracked, and any that have changed when you save the session are sent to the database in a single transaction. Naturally, the RavenDb client has LINQ support too, with paging in queries being especially trivial to implement.

Here’s a complete snippet showing everything you need to store and retrieve objects from RavenDb.

class RavenDbDemo
    public void Demonstrate()
        // DocumentStore is a heavy-weight object usually created once per application
        var documentStore = new DocumentStore() {Url = "http://myravendbserver.com"};
        // session objects are light-weight and are created per transaction
        using (var session = documentStore.OpenSession())
            var person = new Person()
                    Name = "Samuel Jack",
                    FavouriteDatabase = "Sql Server"
        using (var session = documentStore.OpenSession())
            var person = session.Query<Person>()
                .First(p => p.Name == "Samuel Jack");
            person.FavouriteDatabase = "RavenDb";
    public class Person
        public int Id { get; set; }
        public string Name { get; set; }
        public string FavouriteDatabase { get; set; }


The Getting Started with NoSQL Guide will get you hands-on with NoSQL in minutes with no coding needed. Brought to you in partnership with Couchbase.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}