Menu

1 / 5

Document Databases: How MongoDB Stores Data

DEV Community: mongodb·Abdeldjalil Chougui·1 day ago
#XjBIY3iT
#devtomongodb#devto#dev#document#collection
Long article (1290 words) — no AI summary yet.
Reading 0:00
15s threshold

In a relational database, a blog post with its tags and comments is spread over several tables: posts , tags , post_tags , comments . To show one page, you join them back together. Your application code, meanwhile, works with a single object: a post that has a list of tags and a list of comments. A document database removes that gap. It stores the object roughly as your code sees it, as one document.

MongoDB is the best-known document database. This article explains what a document is, how MongoDB stores and finds documents, and the main design decision you make with it: embed or reference.

What a document is

A document is a set of field and value pairs, like a JSON object. Values can be strings, numbers, dates, booleans, nested objects and arrays.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.