Skip to content

Commit 5094e20

Browse files
mungitoperritojeff-allen-mongo
authored andcommitted
DOCS-13889 display freeStorageSize limit
1 parent 3ab1290 commit 5094e20

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

source/reference/command/dbStats.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ Output
151151
allocated to indexes. See :data:`~dbStats.indexFreeStorageSize` for
152152
the total free index size.
153153

154+
This value is always included in the :dbcommand:`dbStats` output.
155+
154156
.. versionadded:: 5.0
155157

156158
.. data:: dbStats.indexes
@@ -219,4 +221,15 @@ Output
219221
Total size of all disk capacity on the filesystem where MongoDB
220222
stores data.
221223

222-
.. versionadded:: 3.6
224+
Examples
225+
--------
226+
227+
If you are only interested in one field, the output of the
228+
:dbcommand:`dbStats` command can be limited to just that field. For
229+
example, the following command returns the current total free
230+
storage size.
231+
232+
.. code-block:: javascript
233+
234+
db.runCommand( { dbStats: 1 } ).freeStorageSize
235+

source/reference/method/db.stats.txt

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
8284
For an explanation of the
8385
output, 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

Comments
 (0)