How do Document Databases Work?

A document database has information retrieved or stored in the form of a document or other words semi-structured database. Since they are non-relational, so they are often referred to as NoSQL data. 

The document database fetches and accumulates data in forms of key-value pairs but here, the values are called as Documents. A document can be stated as a complex data structure. Document here can be a form of text, arrays, strings, JSON, XML, or any such format. The use of nested documents is also very common. It is very effective as most of the data created is usually in the form of JSON and is unstructured.

Advantages

Document databases are both natural and flexible for developers to work with.

  •  They offer higher productivity and faster evolution for a developer. 
  • Document databases are easier to store and query data in a database for a developers by using the same document-model format they use in their application code. 
  • For use cases such as catalogs, user profiles, and content management systems where each document is unique and evolves over time, it is much better to use document model. 
  • Document databases provide flexible indexing, powerful ad hoc queries, and analytics over collections of documents. 

Disadvantages

  • Handling multiple documents is challenging
  • Aggregation operations may not work accurately.

Consider the below example that shows a sample database stored in both Relational and Document Database
 



Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.