# RavenDB

RavenDB is an open-source document-oriented database written in C#, developed by Hibernating Rhinos Ltd. It is cross-platform, supported on Windows, Linux, and Mac OS. RavenDB stores data as JSON documents and can be deployed in distributed clusters with master-master replication.

## History

Originally named "Rhino DivanDB", RavenDB began in 2008 as a project by Oren Eini (aka Ayende Rahien) and is developed by Hibernating Rhinos Ltd. The company claims it was the first document database to run natively in the .NET Framework. It was an early document database to offer ACID guarantees.
In 2019, Hibernating Rhinos began offering RavenDB as a cloud service named RavenDB Cloud.

## Version history

| Version | Date | Features added (partial list) |
| 1.0 | May 2010 | |
| 2.0 | January 2013 | Replication |
| 2.5 | June 2013 | Projections; facet querying |
| 3.0 | November 2014 | Java API; Voron storage engine |
| 3.5 | October 2016 | Clustering |
| 4.0 | February 2018 | Became cross-platform; available with a free license |
| 4.1 | August 2018 | Cluster-wide transactions |
| 4.2 | May 2019 | Graph querying |
| 5.0 | July 2020 | Time series; Data compression using the Zstd algorithm |
| 5.1 | November 2020 | Indexing attachments; Hub/Sink replication with filtering |
| 5.2 | June 2021 | OLAP ETL; Custom Analyzers |
| 5.3 | November 2021 | Concurrent Data Subscriptions; Microsoft Power BI support |
* Red: Not supported
* Green: Supported

### System architecture

Data is stored as schemaless documents in JSON format. Documents are grouped into collections, with each document having exactly one collection.
Databases can be deployed on a distributed cluster of servers (called ‘nodes’) using multi-master replication. Some operations at the cluster level require a consensus of a majority of nodes; consensus is determined using an implementation of the Raft algorithm called Rachis. Tasks are distributed to the different nodes in a balanced way.
Versions 1.0 through 3.5 supported sharding, but versions 4.x do not.
RavenDB originally used the ESENT storage engine. Version 3.0 replaced it with a new open-source storage engine called Voron.
Clients are supported for C#, C++, Java, NodeJS, Python, Ruby, and Go.

## Main features

* Cluster-wide ACID Transactions - ACID transactions can be executed at the scope of a cluster (in addition to single node transactions). The transaction will only be persisted if it is confirmed by a consensus of nodes; if it is not, the transaction is cancelled and rolled back.
* Distributed counters

### Indexes and querying

Queries are expressed in LINQ or with a custom query language named RQL (stands for Raven Query Language) with syntax similar to SQL.
* Dynamic indexes - in RavenDB is that queries can only be satisfied by an index; if no appropriate index exists, a new index is created to satisfy the query.
* Graph querying - related documents can be treated as vertices in a graph, with the connections treated as edges. This makes it possible to create recursive queries.
* Projection - indexes can be configured to transform indexed data, perform calculations, perform aggregations, and execute JavaScript code on the server side.
* Full-text search - at a low level, data is indexed with Lucene.net, which means indexes support full-text search.

## Document extensions

Documents can be extended with other data types less suited to JSON. These extensions can be loaded, modified, and stored independently of the document itself.
* Attachments - documents can have multiple attachments of any data type, such as images, audio, or pure binary.
* Time Series - numerical data associated with specific times and ordered chronologically.

## RavenDB Cloud

RavenDB Cloud is a managed database-as-a-service launched in 2019 on AWS, Azure, and GCP. The service performs administration tasks such as hardware maintenance and security for users. It features the sharing of CPU resources among the different nodes in a cluster to avoid throttling.

## Embedded instance

RavenDB can also be run as an embedded instance, a great option for smaller applications and proof of concepts, for instance.
From their Server: Running an Embedded Instance page: "RavenDB makes it very easy to be embedded within your application, with RavenDB Embedded package you can integrate your RavenDB server with a few easy steps."

## Licensing

RavenDB is open source under an AGPLv3 license. It is available with a commercial license and a free license for open source projects, but it must be applied for.