A document database, also called a document store or document-oriented database, is a subset of a type of NoSQL database. Some document stores may also be key-value databases. A document database is used for storing, retrieving, and managing semi-structured data. Unlike traditional relational databases, the data model in a document database is not structured in a table format of rows and columns. The schema can vary, providing far more flexibility for data modeling than relational databases.
A document database uses documents as the structure for storage and queries. In this case, the term “document” may refer to a Microsoft Word or PDF document but is commonly a block of XML or JSON. Instead of columns with names and data types that are used in a relational database, a document contains a description of the data type and the value for that description. Each document can have the same or different structure. To add additional types of data to a document database, there is no need to modify the entire database schema as there is with a relational database. Data can simply be added by adding objects to the database.
Documents are grouped into “collections,” which serve a similar purpose to a relational table. A document database provides a query mechanism to search collections for documents with particular attributes.
Document stores offer important advantages when specific characteristics are required, including:
USING RIAK AS A DOCUMENT DATABASE
When the data being persisted is easily rendered as a JSON document and needs to be queried, Riak is an excellent solution for persisting and modeling document data.
STEP BY STEP: IMPLEMENTING A DOCUMENT STORE WITH RIAK
Learn how Riak can be used as a highly scalable, highly available document store with rich, full-text query capabilities.