Look Mom, NoSQL! - 3. On Raven's Wings

Category: Data
Last Modified: Oct 16 2021
Nov 17 2011

In my continuing research into NoSQL databases I needed to find a database to work with.  As a .NET developer I was immediately drawn to RavenDB – a Document Database written in .NET  by Ayende Rahien of NHibernate and Rhino Mocks fame.

Not only is RavenDB written in .NET but it supports LINQ – who can complain at that !!  RavenDB is open source (with a commercial license option).  It can be used in 3 modes:

  1. As a Windows Service
  2. As an IIS Application
  3. Embedded in a .NET Application

As .NET developers,  one of RavenDB’s strengths is that its Indexes can be written using LINQ queries:

from post in docs.Posts select category in post.Categories select new { category }

Unlike RDMS Systems, RavenDB’sIndexes do not slow CRUD performance.  This is because the Indexes are processed in the background and the results persisted in a Lucene Index. 

For those of you who need to compare this to how relational database systems work, a RavenDB Index is like a View – with the addition that the data is saved to disk – not dynamically generated on demand.  This is one of the reasons why Document Databases are fast.  You can find more information on how RavenDB indexes work in the RavenDB documentation.

Like most Document Databases RavenDB supports a RESTFull Interface.  For example, assuming that there is a RavenDB installed on port 8080 as an IIS application, using something like Fiddler, we can send an HTTP GET statement"

GET http://localhost:8080/docs/bobs_address

and assuming there is a document in the database with an id of bobs_address RavenDB will return a JSON document  and an HTTP  200 OK response:

HTTP/1.1 200 OK  {   "FirstName": "Bob",   "LastName": "Smith",   "Address": "5 Elm St." }

If the url does not correspond to a valid document then RavenDB will respond with the typical 404 message

HTTP/1.1 404 Not Found

As a .NET application RavenDB also has a rich Client API, which I will dive into much more detail in future posts as I build a RavenDB application.

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Tags