Raven, a Document Database for .NET

| by Abel Avram Follow 12 Followers on May 19, 2010. Estimated reading time: 2 minutes |

Raven is schema-less LINQ-enabled document data store for .NET/Windows. Raven is yet another NoSQL, non-relational solution that wants to address the performance and scalability needs required by large web applications.

Raven can store all sorts of data as JSON documents without imposing a specific schema on their content. That means data can have arbitrary formats being appropriate for the following scenarios:

  • Web Related Data, such as user sessions, shopping cart, etc. - Raven's document based nature means that you can retrieve and store all the data required to process a request in a single remote call.
  • Dynamic Entities, such as user-customizable entities, entities with a large number of optional fields, etc. - Raven's schema free nature means that you don't have to fight a relational model to implement it.
  • Persisted View Models - Instead of recreating the view model from scratch on every request, you can store it in its final form in Raven. That leads to reduced computation, reduced number of remote calls and improved overall performance.
  • Large Data Sets - The underlying storage mechanism for Raven is known to scale in excess of 1 terabyte (on a single machine) and the non relational nature of the database makes it trivial to shard the database across multiple machines, something that Raven can do natively.

The following snippet is an example of a document stored in Raven:

     "Title":"Storing commercial files on the server",
                 "Text":"are they \"sensitive\" information?",
                 "Text":"I wouldn't say they are sensitive information...",

Each document has a key or a document ID associated with it, the key being “2321816” for the example mentioned above. Beside documents, Raven can store metadata or text/binary attachments attached to documents. To be able to search through and retrieve documents from a data store, Raven employs indexes:

An index is a Linq query that operates over a set of documents, producing a projection out of each document that can be efficiently queried. An index is essentially a Linq query that Raven executes in the background, and whose results are stored in persistent storage. Those results can be efficiently queried at a later date.

An example of an index which organizes posts by Title is:

from post in docs.Posts

where post.AcceptedAnswerId != null

select new { post.Title };

After the index has been created, the user simply queries it to get the document he is looking for.

Raven has an HTTP API and a Client API (C#). The HTTP API provides about the same functionality as the Client API permitting to work only by using JavaScript and HTML. Some of the commands are:

The HTTP API also supports getting multiple documents in one call or batching requests.

Raven was released with 3 licensing options:

  • Raven DB Community – a free edition that can be used only for open source projects with no support
  • Raven DB Commercial – a paid-for edition for commercial software with support for a limited number of incidents/year
  • Raven DB Enterprise – similar to Commercial but has extra features like sharding, unlimited master/slave replicas, failover, replication to RDBMS, and better support.

Both commercial editions have a monthly subscription or a perpetual license. Raven was created by Hibernating Rhinos, a consultancy founded by Ayende Rahien.

Other resources: Raven DB website, Source code repository, Raven DB – An Introduction by Ayende Rahien, Discussion group.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Couch DB for Windows by Sarunas Mazylis

Finally, Couch DB for Windows with LINQ provider

Cost by Sarunas Mazylis

Though license prices at the moment are mad at least.

Re: Cost by Alex VanLaningham

Exactly why not use the free MondoDB with a C# driver, it is proven and some drivers support linq. (and
Mashup Architect and SMS Solutions

Re: Cost by Chris Thames

I'm behind you on that. There should be no cost for using it non-commercial or commercially. The only cost should be in support, IF you want paid support. Community support should be free. In otherwords, Hibernating Rhinos should follow the MongoDB licensing model. I like Ayende, but this is a little greedy IMHO. Granted they did put a lot of effort into this project, I believe that the .NET world would be better off with a completely open version. This kind of charging in the Microsoft community is what is pushing people to Rails. Look at TekPub. They went from ASP.NET MVC to Rails, because of the cost factor. Poor judgement Ayende and company.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss