A document-oriented database or a NoSQL document store is a modern way to store data in JSON format rather than simple rows and columns. It allows you to express data in its natural form the way it's meant to be.
For the past 40 years, relational databases have dominated the database industry. Relational databases organize data in tables of rows and columns and generate relationships between them. These relationships are considered to be the logical connections between the tables and are defined on the basis of the data itself.
However relational databases were unable to cope up with the challenges stated below.
With such problems faced by data intensive and fast moving organizations, new technology solutions were demanded and the answer is NoSQL Document Databases. In contrast to rows and columns, NoSQL databases keep data in documents. These documents follow a minimum of standard format rules (so that the database can understand it for post processing). The format used could be JSON, XML, YAML etc. The JSON format is the format of choice for NoSQL databases, and for good reason. A JSON document is simply more compact and more readable.
JSON (JavaScript Object Notation) is a data representation format formulated by the JavaScript programming language. But because of its textual nature it is also used by all other programming languages.
The beauty of JSON lies in its ease of use, by both humans and computers. The JSON format has three basic foundations:
To see all three basic foundations in a single document, please take a look at the following JSON document.
Here you can see that the JSON document holds primitive types as values as well as other JSON objects and array types. What's interesting is that values can also host arrays of JSON objects. Thus JSON documents allow you to create a hierarchy of embedded JSON objects to an unlimited level. It's completely up to the user what shape he or she wants to give to the data stored in a NoSQL document database.
With such great advantages of the JSON data format, let's re-visit the challenges relational databases face and how a document database overcomes them.
Agile Software Development is a process built on principles which follow adaptive and evolutionary processes. Therefore, it is essential that all of the platforms taking part in the software process are responsive to the application changes required. NoSQL document databases are purpose built for this.
JSON documents are stored in a collection, a term identical to tables (that store rows and columns). At the time of inception of a collection there is no need to define the attributes. Thus if there is a need to change the schema, simply add new JSON documents following the new schema without affecting existing data.
Document databases also eliminate the need for specific database modeling teams since the data schema is directly generated by the application. Therefore, document databases promote application driven data models. The .NET API of NosDB automatically generates the corresponding JSON schema with respect to the provided .NET objects. Thus it also eliminates the need for specific ORM libraries, making your applications lightweight.
In relational databases, you create relations between different tables and then perform JOIN queries repeatedly to obtain the same piece of information again and again. It would be faster to group these pieces of data together since they are repeatedly accessed together. JSON documents allow you to embed related documents allowing easy fetching of data in one single call. Therefore, storing data in the JSON format is truly a natural way to store information unlike the flat data structure of rows and columns.
Furthermore, breaking the fixed relations between tables allows NoSQL databases to easily distribute data across multiple machines, thus also distributing the read and write load. Distribution has its own set of advantages and is further discussed under the topic Why NoSQL.
While document databases provide a new way to store data, it doesn't mean you have to learn a new method to access data. NosDB allows you to access JSON documents using standard SQL and LINQ and it hosts strong indexing capabilities. NosDB is integrated with the .NET stack including an ADO.NET provider and integration with PowerShell, Visual Studio and Microsoft PowerBI.