BT

InfoQ Homepage News Raven, a Document Database for .NET

Raven, a Document Database for .NET

Bookmarks

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:

{
     "PostTypeId":1,
     "Id":2321816,
     "Title":"Storing commercial files on the server",
     "AcceptedAnswerId":2321854,
     "LastActivityDate":"\/Date(1266953391687+0200)\/",
     "AnswerCount":3,
     "Comments":[
                 {
                 "Score":null,
                 "CreationDate":"\/Date(1266952919510+0200)\/",
                 "Text":"are they \"sensitive\" information?",
                 "UserId":"users/203907"              
      },
                 {
                 "Score":null,
                 "CreationDate":"\/Date(1266953092057+0200)\/",
                 "Text":"I wouldn't say they are sensitive information...",
                 "UserId":"users/200145"              
      }       
   ]
}

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
Style

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.

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

Community comments

  • Couch DB for Windows

    by Sarunas Mazylis /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Finally, Couch DB for Windows with LINQ provider

  • Your message is awaiting moderation. Thank you for participating in the discussion.

    Though license prices at the moment are mad at least.
    ravendb.net/licensing

  • Re: Cost

    by Alex VanLaningham /

    Your message is awaiting moderation. Thank you for participating in the discussion.

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

    www.crewtrumpet.com (and www.forwardvisibility.com)
    Mashup Architect and SMS Solutions

  • Re: Cost

    by Chris Thames /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.