Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Raven, a Document Database for .NET

Raven, a Document Database for .NET

This item in japanese

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