@@ -62,23 +62,25 @@ the database system's state. For example:
6262.. code-block:: javascript
6363
6464 {
65- "db" : "test",
66- "collections" : 6,
67- "views" : 0,
68- "objects" : 400629,
69- "avgObjSize" : 663.996695196803,
70- "dataSize" : 266016332,
71- "storageSize" : 179838976,
72- "indexes" : 13,
73- "indexSize" : 9940992,
74- "totalSize" : 189779968,
75- "scaleFactor" : 1,
76- "fsUsedSize" : 126727540736,
77- "fsTotalSize" : 499963174912,
78- "ok" : 1
65+ "db" : "admin",
66+ "collections" : 2,
67+ "views" : 0,
68+ "objects" : 5,
69+ "avgObjSize" : 336.8,
70+ "dataSize" : 1684,
71+ "storageSize" : 69632,
72+ "freeStorageSize" : 28672,
73+ "indexes" : 3,
74+ "indexSize" : 106496,
75+ "indexFreeStorageSize" : 45056,
76+ "totalSize" : 176128,
77+ "totalFreeStorageSize" : 73728,
78+ "scaleFactor" : 1,
79+ "fsUsedSize" : 47881682944,
80+ "fsTotalSize" : 62725623808,
81+ "ok" : 1
7982 }
8083
81-
8284For an explanation of the
8385output, see :ref:`dbstats-output`.
8486
@@ -112,3 +114,20 @@ The following example returns various size values in kilobytes:
112114.. note::
113115
114116 The scale factor rounds values to whole numbers.
117+
118+ You can also use ``db.stats()`` to return a single value, such as the
119+ ``freeStorageSize``.
120+
121+ .. code-block:: javascript
122+
123+ db.stats().freeStorageSize
124+ db.stats(1024).freeStorageSize
125+
126+ The output shows the difference between the raw and scaled values.
127+
128+ .. code-block:: javascript
129+ :copyable: false
130+
131+ 28672
132+ 28
133+
0 commit comments