1. View the database
>db.stats (); { "DB":"Test", //Current Database"Collections": 3,//How many tables are in the current database"Objects": 4,//Current Database All tables how many data"avgobjsize": 51,//average size of each piece of data"datasize": 204,//total size of all data"storagesize": 16384,//disk size for all data"numextents": 3, "Indexes": 1,//Number of indexes"indexsize": 8176,//Index Size"fileSize": 201326592,//file size pre-allocated to the database"Nssizemb": 16, "datafileversion" : { "Major": 4, "Minor": 5 }, "OK": 1 }
2. View database tables
db.posts.stats (); { "NS":"test.posts", "Count": 1, "size": 56, "avgobjsize": 56, "storagesize": 8192, "numextents": 1, "nindexes": 1, "lastextentsize": 8192, "Paddingfactor": 1, "Systemflags": 1, "userflags": 0, "totalindexsize": 8176, "indexsizes" : { "_id_": 8176 }, "OK": 1 }
MongoDB view database and table size