Untitled document.
Untitled document.
—------------------------------------------------------------------------------------------------------------------------------------------------
"age": 30,
"address": {
"zip": "10001"
<name>John Doe</name>
<age>30</age>
<skills>
<skill>Python</skill>
<skill>SQL</skill>
</skills>
<address>
<city>New York</city>
<zip>10001</zip>
</address>
</person>
○ These formats allow for variable fields, hierarchies, and nesting.
2. Storage in Documents:
○ Data is stored as documents in collections (in NoSQL databases like MongoDB).
○ Documents are self-contained and may have different structures within the same collection.
3. Self-Describing:
○ Each document includes metadata (keys/tags) describing the stored data, so there is no need
for a rigid schema.
code:
db.users.find({ age: { $gt: 25 } });
3. Indexes:
○ Indexes can be created on fields (e.g., name, age) to improve query performance.
4. APIs:
○ Data is often accessed through APIs (e.g., REST or GraphQL), which return data in JSON
format.
Key Features
● Dynamic Schema: New fields can be added to documents without affecting the database structure.
● Nested Data: Hierarchical data can be easily stored, such as arrays or objects.
● Scalability: These databases are optimized for distributed and scalable storage systems.
Semi-structured databases bridge the gap between structured and unstructured data, offering flexibility and
scalability for modern applications.