- 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
Get the storage size of a database in MongoDB?
To get the storage size of a database in MongoDB, use the stats() method.
At first, check the current database with the help of the following query −
> db;
The following is the output −
test
Here is the query to get the storage size of the database in MongoDB −
> db.stats()
The following is the output displaying the stats including the storage size −
The following is the output −
{ "db" : "test", "collections" : 114, "views" : 0, "objects" : 391, "avgObjSize" : 83.0076726342711, "dataSize" : 32456, "storageSize" : 3211264, "numExtents" : 0, "indexes" : 120, "indexSize" : 2494464, "fsUsedSize" : 126172377088, "fsTotalSize" : 199229435904, "ok" : 1 }
Advertisements