A social app stores user profiles, each with nested collections of posts and comments, and different users have different fields. The developers do not want to define rigid table schemas. Which database type suits this workload?
Show answer and explanation
Answer: D
Document databases store records as flexible, often nested structures, and they do not require every record to share the same fields. Firestore fits application data such as user profiles, posts, and comments, where hierarchy and evolving fields are common. Relational databases suit strict joins and fixed schemas, analytical warehouses suit large scans, and in-memory caches favor speed over rich queries.
Why the other options are wrong
- A. Fixed relational schemas require defined columns and joins up front. That conflicts with varying fields and nested per-user structures.
- B. A warehouse is optimized for analytical scans over large datasets. It is not designed to serve nested application records with low-latency reads and writes.
- C. An in-memory cache trades durability for speed and offers simple key lookups. It does not provide hierarchical documents with rich querying and persistence.