juniorMongoDB
What is a Document in MongoDB?
Updated May 1, 2026
Short answer
A document is the basic unit of data in MongoDB, analogous to a row in an RDBMS table.
Deep explanation
Documents are composed of field-value pairs. Values can include other documents, arrays, and arrays of documents. This nesting allows for complex data structures within a single record.
Real-world example
Storing a user profile with nested address and preference objects.
Common mistakes
- Exceeding the 16MB document size limit.
Follow-up questions
- What is the max document size?