A fixed set refers to a set that is created in advance and fixed in size.
Fixed set properties: Fixed collections are like ring queues, and if there is not enough space, the earliest documents are deleted, freeing up space for new documents. In general, fixed collections are suitable for any scenario where you want to automatically retire expired attributes, and there are not too many operational restrictions.
To create a pinned collection using the command:
Db.createcollection ("CollectionName", {capped:true,size:100000,max:100});
SIZE Specifies the collection size in Kb,max for the specified number of documents
When you specify a limit on the number of documents, you must specify both size. The elimination mechanism will only work based on the number of documents when the capacity is not yet full. If the capacity is full, the elimination mechanism will work according to capacity.
To convert a normal collection to a fixed collection:
Db.runcommand ({converttocapped: "CollectionName", size:10000,max:100});
MongoDB fixed set (capped collection)