- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the MongoDB Capped Collection maximum allowable size?
It is up to you how much space you want. You need to use the parameter size to set. Use below syntax −
db.createCollection(‘yourCollectionName’, capped=true, size=yourValue);
Let us implement the above syntax in order to allow size for a capped collection −
> db.createCollection('cappedCollectionMaximumSize', capped=true, size=1948475757574646); { "ok" : 1 }
Let us check the description of the above collection −
> db.cappedCollectionMaximumSize.find().explain();
This will produce the following output −
{ "queryPlanner" : { "plannerVersion" : 1, "namespace" : "test.cappedCollectionMaximumSize", "indexFilterSet" : false, "parsedQuery" : { }, "winningPlan" : { "stage" : "COLLSCAN", "direction" : "forward" }, "rejectedPlans" : [ ] }, "serverInfo" : { "host" : "DESKTOP-QN2RB3H", "port" : 27017, "version" : "4.0.5", "gitVersion" : "3739429dd92b92d1b0ab120911a23d50bf03c412" }, "ok" : 1 }
Advertisements