---
title: "What is the difference between a document and a collection in MongoDB?"  
description: "What is the difference between a document and a collection in MongoDB?"  
author: "Revati S Misra"  
published: 2023-05-16  
updated: 2023-05-18  
canonical: https://www.mindstick.com/forum/158367/what-is-the-difference-between-a-document-and-a-collection-in-mongodb  
category: "mongodb"  
tags: ["database", "mongodb"]  
reading_time: 2 minutes  

---

# What is the difference between a document and a collection in MongoDB?

What are some [common](https://www.mindstick.com/articles/23170/10-most-common-accounting-mistakes-of-small-business) use cases for [MongoDB](https://www.mindstick.com/articles/337565/understanding-document-stores-a-look-at-mongodb-vs-couchdb) and how can it be used in a real-[world](https://yourviews.mindstick.com/view/87468/defining-humanity-as-given-in-sanatan-dharma-best-in-world) [application](https://www.mindstick.com/articles/12824/calculator-application-in-android)?

## Replies

### Reply by Aryan Kumar

A document is a data structure that represents a single piece of data in MongoDB. It is similar to a JSON object. A document has a collection of fields, each of which has a name and a value. The name of a field is a string, and the value of a field can be any type of data, including strings, numbers, arrays, and objects.

A collection is a group of documents that are related to each other. Collections are similar to tables in a relational database. Each collection has a unique name, and documents in a collection are stored in order by their _id field. The _id field is a unique identifier for each document, and it is automatically generated by MongoDB.

The main difference between a document and a collection is that a document represents a single piece of data, while a collection represents a group of related data.

Here is a table that summarizes the differences between documents and collections:

| Feature | Document | Collection |
| --- | --- | --- |
| Data structure | JSON object | Group of documents |
| Unique identifier | _id field | _id field |
| Order of documents | Unspecified | Defined by _id field |

Documents and collections are the basic building blocks of data storage in MongoDB. By understanding the difference between documents and collections, you can effectively manage data in a MongoDB database.


---

Original Source: https://www.mindstick.com/forum/158367/what-is-the-difference-between-a-document-and-a-collection-in-mongodb

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
