---
title: "What is the difference between a capped collection and a regular collection in MongoDB?"  
description: "What is the difference between a capped collection and a regular collection in MongoDB?"  
author: "Revati S Misra"  
published: 2023-05-16  
updated: 2023-05-18  
canonical: https://www.mindstick.com/forum/158375/what-is-the-difference-between-a-capped-collection-and-a-regular-collection-in-mongodb  
category: "mongodb"  
tags: ["database", "mongodb"]  
reading_time: 3 minutes  

---

# What is the difference between a capped collection and a regular 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

\
The main difference between a capped collection and a regular collection in MongoDB is that a capped collection has a fixed size. Once the capped collection reaches its maximum size, new documents inserted into the collection will overwrite the oldest documents in the collection. Regular collections, on the other hand, do not have a fixed size. Documents can be inserted into regular collections without any limit.

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

| Feature | Capped Collection | Regular Collection |
| --- | --- | --- |
| Size | Fixed | Unfixed |
| Overwriting | Oldest documents are overwritten when the collection reaches its maximum size. | Documents are not overwritten. |
| Indexing | No default indexes are created. | Default indexes are created on the _id field. |
| Use cases | Good for applications that require a fixed-size collection, such as message queues and activity logs. | Good for applications that do not require a fixed-size collection, such as document databases and search engines. |

Here are some examples of when you might want to use a capped collection:

- **A message queue:** A message queue is a data structure that stores messages that are waiting to be processed. Capped collections are a good choice for message queues because they can ensure that the queue does not grow too large.
- **An activity log:** An activity log is a record of all of the actions that have been taken by a user or system. Capped collections are a good choice for activity logs because they can ensure that the log does not grow too large and that the oldest logs are overwritten.

Here are some examples of when you might want to use a regular collection:

- **A document database:** A document database is a database that stores data in the form of documents. Regular collections are a good choice for document databases because they can store any type of data and they can be indexed on any field.
- **A search engine:** A search engine is a system that allows users to search for information. Regular collections are a good choice for search engines because they can be indexed on any field and they can be searched quickly.


---

Original Source: https://www.mindstick.com/forum/158375/what-is-the-difference-between-a-capped-collection-and-a-regular-collection-in-mongodb

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
