Short answer
A document database stores each record as a document of field-value pairs, often JSON or BSON, instead of a row in a fixed table. MongoDB describes a document as one object plus related metadata, and CouchDB stores JSON documents you read over HTTP. Fields can differ from one document to the next.
Last verified against the sources listed below.
Key takeaways
- MongoDB calls a document a record: field-value pairs, stored as JSON, BSON, or XML.
- BSON is a binary form of JSON-like documents and adds types such as Date and BinData.
- A collection groups documents. They do not all have to contain the same fields.
- CouchDB stores JSON documents and reads them with an HTTP API.
- Relational rows split related values across tables. A document keeps them together.
- The MongoDB manual caps one BSON document at 16 mebibytes. Larger files use GridFS.
What is document database, in plain words, is a database that stores information in documents rather than only in fixed rows and columns. MongoDB’s own page defines a document as a record that typically holds one object and its related metadata, in field-value pairs. Those values can be strings, numbers, dates, arrays, or objects, in formats such as JSON, BSON, and XML.
What is a document database in practice is that modeling choice. The examples below are MongoDB and CouchDB, from pages opened for this guide. Nothing here claims a document store is faster than a relational one. Relational databases remain the right comparison when the data is rows.
Back-end development is where you pick the store the application talks to. The record shape should match the object your API already returns.
A document is one record, kept together
A document is one record that keeps an object and its related metadata together. MongoDB’s manual says a document is the basic unit of data, made of field-and-value pairs, and that MongoDB stores data records as BSON. BSON, it says, is a binary representation of JSON documents with more data types than JSON.
JSON.org defines JSON as text: a collection of name/value pairs, and an ordered list of values. BSON’s spec calls BSON a binary-encoded serialization of JSON-like documents. Like JSON, it can nest documents and arrays. It also adds types JSON does not have, and the spec names Date and BinData.
CouchDB’s introduction says to store your data with JSON documents and to access them in the browser over HTTP. Its technical overview says documents are the primary unit of data, with any number of fields and attachments, plus metadata the database maintains. A single-document update is all or nothing. The database does not keep a half-saved document.
That is the “one record” idea, in the vendors’ words. Related values do not have to be split into extra tables before you can save the object. MongoDB’s page shows a user, their likes, and their businesses in one document, then shows the same facts as three relational tables joined by ids. The difference it draws is the shape, not a benchmark.
How a document database is organized
Documents live in collections, and you read or write them through an API or query language. MongoDB says a collection groups documents with similar contents, and that they need not share every field. Optional schema validation can lock the shape down when you want that.
The usual operations are create, read, update, and delete. Each document has a unique identifier. You can query by that id or by field values, and you can add indexes for reads. Updates can change the whole document or part of it.
In MongoDB the identifier field is _id. The manual says it is the primary key, it must be unique in the collection, and it is always stored first. If an insert omits it, the driver or server adds an ObjectId. Field names inside one document must be unique.
CouchDB names each document in the database and uses an HTTP API to read and update it. Views, defined in JavaScript, aggregate and report on documents without rewriting them into tables first. The introduction describes the system as eventually consistent, with incremental replication. Those are CouchDB’s terms for how copies converge, not a speed score.
Documents beside relational rows
A document keeps nested values on the record. A relational row keeps one line of columns and points at other tables for the rest. MongoDB’s page uses that contrast: no requirement to decompose one object across tables for the user example, because the document holds the object and the related metadata.
| Document | Relational row | |
|---|---|---|
| Unit | A document of field-value pairs | A row in a table with a fixed set of columns |
| Related facts | Nested in that document, or stored as another document | Split into more tables and combined with joins |
| Shape | Fields can differ between documents in one collection | Columns are defined for the table |
| Text form | JSON, and BSON as MongoDB’s binary form. CouchDB uses JSON | Not a JSON document by default |
| Identifier | _id in MongoDB. A document name in CouchDB |
A key column you define on the table |
JSON is the text both descriptions lean on. A name/value pair in JSON is the same idea as a field and a value in MongoDB’s document. An array in JSON is how a list, such as several likes, stays on that one record instead of becoming a child table.
This table does not say joins are forbidden in a document store. MongoDB’s page says related data can also live in separate documents, with references between them. The common case it describes is embedding what you read together.
Two examples
MongoDB and CouchDB are the two examples these pages support. Other products exist. They are not described here, because their docs were not the ones opened.
MongoDB is the document database its overview page says it is. You work with collections of BSON documents. The manual’s sample document nests a name object, dates, and an array of strings under one _id.
The company’s document-database page also says Atlas has a forever-free option and that Community Server is available under the Server Side Public License. Those are license and plan statements from that page, not prices.
CouchDB is the HTTP and JSON example. You create a database, put a JSON document in it, and query or replicate from there. The overview stresses that the document is already packaged for storage, rather than split across numerous tables and rows. Conflicts are normal in its replication story: if two edits save the same document, one side gets a conflict and retries against the latest version.
A small JSON object, in the shape JSON.org describes, looks like this:
{"name": "Tom", "likes": ["fashion", "spas"]}
That is two name/value pairs, and one of the values is an ordered list. A document database can store that object as the record. A relational design of the same facts, as in MongoDB’s walkthrough, would use a users table and a likes table.
Why the shape matters, and common mistakes
The shape matters because the application already thinks in objects. MongoDB says documents map to objects in common programming languages, so you are not required to add a separate object-relational mapping layer for the embedded case. CouchDB makes the same packaging point. Whether that saves work depends on how rectangular the data is, and it is not a performance number.
Mistakes usually come from treating the document like a loose file, or from treating it like a table that forbids nested fields.
| Mistake | What the docs say instead |
|---|---|
| Assuming every document has the same fields | MongoDB: fields can differ. Validation is optional. |
| Splitting every list into another table out of habit | Related metadata can stay on the document. |
| Expecting a half-written CouchDB document after a crash | A single-document update is all or nothing. |
| Duplicate field names in one MongoDB document | Field names must be unique or queries can disagree. |
| One document for a huge file | MongoDB’s BSON limit is 16 mebibytes. Use GridFS beyond that. |
| Calling the model faster without a measurement | None of the opened pages give you a speed percentage to quote. |
Start with one object you already return from an API, such as a profile with a list of tags. If that object is what you save and what you read, a document matches it. If you mostly need strict columns and many independent tables, stay with the relational model and say so in the design note. The database should follow the record shape, not a slogan about which kind is newer.
Frequently asked questions
What is the size limit of one MongoDB document?
The MongoDB manual says the maximum BSON document size is 16 mebibytes. The limit is there so one document cannot consume an excessive amount of RAM or bandwidth. For larger files, MongoDB points you to GridFS. The manual also says each document in a standard collection needs a unique _id, which acts as the primary key. If you omit _id, the driver or the server adds an ObjectId. Time series collections are the exception the manual notes, because they do not require that unique _id.
Do all documents in a collection need the same fields?
No. MongoDB's document-database page says a collection groups documents with similar contents, and that not every document must have the same fields, because the schema is flexible. Some systems can still validate a schema when you want rules. CouchDB's technical overview says each document has its own implicit structure, with fields of varying types and no set limit on text size or element count in that description. You can add a field on one document without rewriting every other document first.
Is BSON the same thing as JSON?
No. JSON.org defines JSON as a text format built from name/value pairs and ordered lists. The MongoDB manual says BSON is a binary representation of JSON documents with more data types than JSON. BSON's own spec says the same, and it names extensions such as Date and BinData. CouchDB's introduction tells you to store JSON documents and access them over HTTP. Pick the words the product uses: JSON text for CouchDB, BSON documents for what MongoDB stores on disk.
Can two fields in one MongoDB document share a name?
The manual says each field name must be unique inside the document. Field names are strings, and they cannot contain a null character. Duplicate names are not supported for normal CRUD, even if an insert appears to succeed, because queries can then disagree. The _id name is reserved as the primary key. Its value must be unique in the collection, it cannot be an array, and the server moves _id to the first position if it was not already first.
When is a document a poor fit?
Use rows when the data really is a fixed grid and you want columns that exist on every record. MongoDB's comparison is that a relational model splits one object across tables and joins them back. A document keeps the object and its related metadata together, which is awkward if every list must stay perfectly rectangular. CouchDB adds a constraint: a single-document update is all or nothing, and a conflict happens if someone else saved that document first. Neither page is a reason to claim one model is always quicker.
Sources
- What is a Document Database? · MongoDB, 2026
- Documents · MongoDB, 2026
- CouchDB introduction · Apache CouchDB, 2026
- CouchDB technical overview · Apache CouchDB, 2026
- Introducing JSON · JSON.org, 2026
- BSON specification · BSON, 2026