The main concept behind document database is documents which can be JSON, BSON, XML, and so on. Document database stores documents and retrieves documents.
The data structure defined inside the document databases is hierarchical in nature which can be a scalar value, map or a collection. It is similar to a key-value database but the only difference is that the document database stores the data in form of a document which embeds attribute metadata associated with the stored content.
Every document databases use their own file structure to store data. For example, Apache CouchDB uses JSON to store data, javascript as its query language and HTTP protocol for its API’s.
Document databases are one of the main categories of NoSQL databases. XML databases are a subclass of document databases and are optimized to work with XML documents.
Graph databases are similar to document databases. But graph databases have one more layer, the relationship, which allows graph databases to link documents for rapid traversal.
Among the most popular document databases are MongoDB, Informix, DocumentDB, CouchDB, BaseX.
Application of Document Databases
Let us see an example of the application of document database in the real-world scenario.
Financial derivatives trading service management
Financial Product Markup Language (FpML) is the most common type of document in financial services industry.
They follow an XML schema structure. FpML is mainly used for trading purposes in derivative markets.
Financial institutions need to analyze multiple risk metrics and single view of the customer using the FpML document.
These documents are fed to the document databases and by using the dynamic query language to allow granular access to any data attribute. These databases also allow grouping and reshaping of data through their aggregation framework for their intraday analysis.
These databases also allow grouping and reshaping of data through their aggregation framework for their intraday analysis.