NoSQL: Document Stores
Document databases store JSON-like documents instead of rows. Each document can have a different shape, making them ideal for data with evolving schemas — user profiles, content, product catalogs, and mobile app backends where the fields vary by type or version.
MongoDB and Firestore are the most widely used document stores. The key difference from relational databases: there are no JOINs. You either embed related data inside the document (fast reads, larger documents) or reference it by ID and fetch separately (normalized, slower). The right choice depends on how you access the data — embed things you always read together.
Check your understanding
When should you embed related data in a document?Show answerHide answer
Answer
When you almost always read it together and the embedded set stays bounded.When should you reference by ID instead?Show answerHide answer
Answer
When related data is large, independently updated, or read on different paths.What trade-off do you lose vs relational JOINs?Show answerHide answer
Answer
You typically cannot JOIN across collections the same way — you embed or fetch separately.