check MongoDb database size

How to check MongoDb database size?

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:

  1. Login to MongoDb database
  2. Switch to the database with use command. Eg: use database_name
  3. Now, we can run the command: db.stats()
  4. The command shows the details of the database:
How to check MongoDb database size? database detail
How to check MongoDb database size? 3

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/


Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments