Data is stored in scheme-less JSON, and can be retrieved effectively using LINQ via RavenDB .NET API or using the RESTful API over HTTP. Internally, RavenDB uses indexes that are automatically created based on your usage, or created explicitly by the developer.
RavenDB, as it is common in NoSQL databases, is build for web-scale and supports replication and sharding out of the box.
Introduction to RavenDB
Why use NoSQL/RavenDB instead of a RDBMS?
- High developer productivity
- Made to scale
- Impedance mismatch between OOD/Relational model
ORM is the Vietnam of Computer Science. It represents a quagmire which starts well, gets more complicated as time passes, and before long entraps its users in a commitment that has no clear demarcation point, no clear win conditions, and no clear exit strategy
- Every document must have an id
- Documents are stored as JSON
- It is schemaless, the database doesn’t enforce any schema
- Reads are always fast (high read availability)
- Self-optimization based on usage. RavenDB creates and manages indexes automatically and batches certain operations depending on usage.
- Multiple deployment options, client/server or embedded
- .NET and REST APIs. REST APIs is a first class citizen
Safe by default
- Your data is always safe via transactions
- RavenDB protects you from misusing it: it limits the number of database calls preventing N+1, and it protects you against unbounded result sets putting a 128 result cap
RavenDB uses the concepts of documents and collections to store and queryfor data.
The unit of storage in RavenDB is the document, it represents any piece of data (usually a C# POCO - Plain Old CLR Object - or a whole aggregate) serialized as a JSON formatted string. This allows RavenDB to easily store complex object graphs that match very well Object Oriented Programming. Each document is assigned a unique identifier.
One interesting feature related to the use of documents that differences RavenDB from ORMs is that RavenDB works perfectly with pure POCOS, without any need for adding attributes nor configuration. When given an object graph, RavenDB will serialize it to JSON and persist it whole, this, as we will see in some examples later, can be a big mind shift away from RDBMS and data normalization.
to be continued
Written by Jaime González García , Dad, Husband, Front-end software engineer, UX designer, amateur pixel artist, tinkerer and master of the arcane arts. You should follow him on Twitter where he shares useful stuff! (and is funny too).Follow @vintharas