Monday, May 28, 2018

A simple introduction to RavenDB

RavenDB may be an excellent alternative for developers looking for a reliable, robust and friendly NoSql database. Read to understand.

In case you never heard of it, RavenDB is a fast, reliable and extensible NoSql database. Being a NoSql database, it has benefits and drawbacks over Sql databases. On this post, let's take a look at how RavenDB behaves with Linux, containers and .NET Core.

If you're interested in more information on why to use a NoSql database, please check this article.

Why RavenDB?

With so many big names in the NoSql market, why even consider RavenDB?

Easy to use

Raven is extremely easy and simple to use, either by developers and non-technical people. In a couple of minutes, non-technical users were able already to interact with the database with no major hiccups.

Multiplatform

RavenDB is multiplatform and can be installed on Linux, Windows, Mac, Docker and even on a Raspberry Pi. Installation is also straight-forward. On Windows and Linux, testing is as simple as downloading the executable, extracting and running the executable. On Docker, a simple docker pull solves.

Raven Studio

Raven Studio is the front-end to interact with RavenDB. It's the app responsible for making the user experience enjoyable for developers and non-developers alike. It’s included with any license, including the free community version.

Multiple Clients

RavenDB client can be accessed using the major programming languages in the market, including C#, Java, Node, Python, Ruby and Go!

Transactional NoSQL

RavenDB is the first non-relational database to achieve ACID across the entire database. Maintain the best of SQL while boosting your capacity to the next level.

Extensive Management Features

You can set up a distributed data cluster in minutes. Replicate your database in real time so you can be everywhere at once, and always available to your users.

Simple API with an embedded ORM

This is especially important to developers. It means easily creating/updating/deleting records, quicker to test and to release, no migration scripts, simple and powerful api. For example, this is how I insert a record in the database:
Example: a very simple insert operation in Raven.

Simple NoSQL Querying

RavenDB has powerful ways to do query including geospacial, faceted, full-text and map-reduce operations. But since most of the time, what you want is very easily available to you via the api and indexes.
Example: a very simple "select * from Category" query in RavenDB.

Extensive Querying Types

Apart from the simplicity shown above, RavenDB brings awesome querying support such as Full text search, Spatial, Facets and a built-in graph api.

Index Support

Indexes in RavenDB are one of the strongest points. Being a NoSql database, it's an intelligent solution to avoiding multiple requests to the database by merging multiple tables. We will also revise this in future posts.

In-Memory Database

RavenDB has an in-memory database that you can use to persist data from your application (and replace SqlLite for example) or, better yet, use in your tests so you have real db operations (in-memory) without the hassle of creating mocks and simulating your tests.

Extensions / Bundles

You can extend the database with bundles and extensions. Some come already built in for us, others can be created through what they call Bundles. It's more of a technical solution but very interesting feature to have available. For example, these are the out of the box bundles that come with a standard RavenDB installation:

Powerful and Extensive API

Apart from (most of the time) simple operations, we have lots of advanced features in the client api to manage everything from tables (collections), records, bulk operations to database indexes, etc.

RavenDB Cloud

Yes, RavenDB is also available as a SAAS on its RavenDB Cloud. Ideally, it serves really well to small teams so that you get a hosted your databases without any need to manage VMs on your favorite cloud provider.

Final Thoughts

In almost 20 years working with software development, I know how difficult it is to manage and evolve databases during the project life cycle. Being agile today requires releasing as fast as possible and complex operations like data migration can have a big impact on your domain. My experience with RavenDB, is that development, patches, migrations and even clustering are greatly simplified.

And because it makes sense to do polyglot persistence, why not use RavenDB, beside your existing Sql instance of a or even side by side with your MongoDB, CouchDB, Redis and Cassandra? So go ahead, install it on your machine (or test its Cloud) and give it a try!

See Also

About the Author

Bruno Hildenbrand