CompTIA DataSys+ (DS0-001)Database FundamentalsMedium
A data architect is designing a database for a social media application. The application needs to store user profiles, which can have highly varied and evolving attributes (e.g., bio, interests, profile picture URL, social links), without requiring a fixed schema. Which type of NoSQL database would be most appropriate for storing this kind of flexible, nested, and self-describing data?
- AColumn-Family Database
- BGraph Database
- CKey-Value Store
- DDocument Database
Show answer & explanationAnswer & explanation
Correct answer: D. Document Database
Document databases are ideal for storing semi-structured data like user profiles, where each document (e.g., a JSON object) can have its own flexible schema. This allows for easy evolution of attributes without requiring schema migrations.
Why the other options are wrong
- A. Column-family databases are optimized for wide-column data and distributed storage, good for specific analytics but not primarily for flexible, nested user profiles.
- B. Graph databases are designed for highly interconnected data and complex relationship queries, not primarily for storing individual, evolving user profiles with varied attributes.
- C. Key-value stores are simple, optimized for fast retrieval by a unique key, but not ideal for complex, nested, or queryable semi-structured data within the value.
Document Database
A type of NoSQL database that stores data in flexible, semi-structured documents, typically in formats like JSON, BSON, or XML.
- Offers a flexible schema, allowing documents to have different structures.
- Ideal for storing user profiles, catalogs, content management.
- Supports rich query languages for document content.
Memory trick: NoSQL: Keys are simple, Documents are flexible, Columns are wide, Graphs are connected.