Field | Type | Description |
Capped | Boolean | Here true means enables a capped collection. And definition of Capped collection is a fixed size collection which will automatically overwrites oldest entries when it will reaches the maximum size. IF we specify the true then we need to specify the size of parameter also. |
autoIndexId | Boolean | Default value is false and if we use true the it will automatically create index on _id field. |
size | number | Here specifies the maximum size in bytes for capped collection. When we choose capped as true then we need to specify this field also. |
max | number | Here we specifies the maximum number of documents allowed in capped collection. |
Final Syntax | | db.createCollection("myTestcol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } ) |