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.
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.
- 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.