Sometimes we may need to check MongoDb database size and it is a handful to know. In this post, we will learn to check MongoDb database size.
Answer:
- Login to MongoDb database
- Switch to the database with use command. Eg:
use database_name
- Now, we can run the command:
db.stats()
- The command shows the details of the database:
5. We can see the database name zvls and the storageSize which is the actual used size in the database zvls. Hence, it is using the 1253376 bytes of the data and is equivalent to 1.25 mb.
Reference: https://docs.mongodb.com/manual/reference/command/dbStats/