 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- 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
 