3.
Document
Database
Introduction
• Document databases are a type of NoSQL database that store data in a document format, usually
in JSON or XML or BSON format.
• Document Databases use key-value pairs to store and retrieve data from the documents.
• Data is stored as a value. Its associated key is the unique identifier for that value.
• In a document database the value contains structured or
semi-structured data.
• This structured semi-structured value is referred to as a document and can be in XML, JSON
or BSON format.
Comparision between relational and document database
Relational databases Document databases
&
How Document Databases
Work
⚬ Data Model: Document databases use a document data model to
store data. Each document contains data in a key-value pair
format.
⚬ Document Structure: Documents in document databases are
self-contained and can contain nested data structures.
⚬ Querying: Document databases use query languages like
MongoDB Query Language (MQL) to retrieve data.
Advantages
• Schema-less: Document databases are schema-less, which means they can store data without a
predefined schema.
• Flexible: Document databases are flexible and can accommodate changes in data requirements.
• Distributed and Resilient: Document databases are distributed and resilient, which means they
can handle large volumes of data and scale horizontally across multiple servers.
• Manageable Query Language: Document databases have a manageable query language that
allows developers to perform CRUD operations on the data model.
Disadvantages
• Weak Atomicity: Document databases lack support for multi-document ACID
transactions.
• Consistency Check Limitations: Document databases have limitations in
consistency checks when searching collections and documents that are not
connected to an author collection.
• Amazon DocumentDB
• MongoDB
Examples • Cosmos DB
• ArangoDB
• Couchbase Serve
• CouchDB