Using Capped Collections
Capped collections are fixed-size collections that insert, retrieve, and delete documents based on insertion order. A capped collection can support high-throughput operations. Capped collections work much like circular buffers in that once a collection fills its allocated space, it makes room for new documents by overwriting the oldest documents in the collection.
Capped collections can also be limited based on a maximum number of documents. This is useful for reducing the indexing overhead that can occur when storing large numbers of documents in a collection.
Capped collections are extremely useful for rotating event logs or caching data because you do not need to worry about expending the overhead and effort of implementing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access