What is use of capped collection in MongoDB?

Technology CommunityCategory: MongoDBWhat is use of capped collection in MongoDB?
VietMX Staff asked 3 years ago

Capped collections allow you to define a fix length/size collection. After the size/no of documents have been reached it will override the oldest document to accommodate new documents. It is like a circular buffer. Capped collections support high-throughput operations that insert and retrieve documents based on insertion order.

Consider the following potential use cases for capped collections:

  • Store log information generated by high-volume systems. Inserting documents in a capped collection without an index is close to the speed of writing log information directly to a file system.
  • Cache small amounts of data in a capped collections.