Skip to content

Commit 3d4bf8d

Browse files
authored
adds dataSize (#1425)
1 parent 227ad9e commit 3d4bf8d

22 files changed

+1122
-1197
lines changed

source/reference/command/dataSize.txt

Lines changed: 59 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,82 +16,69 @@ Definition
1616
.. dbcommand:: dataSize
1717

1818
The :dbcommand:`dataSize` command returns the size in bytes for
19-
the specified data:
19+
the specified data.
2020

21-
.. code-block:: javascript
21+
Syntax
22+
------
2223

23-
{
24-
dataSize: <string>,
25-
keyPattern: <document>,
26-
min: <document>,
27-
max: <document>,
28-
estimate: <boolean>
29-
}
30-
31-
The command takes the following fields:
32-
33-
34-
.. list-table::
35-
:header-rows: 1
36-
:widths: 20 20 80
37-
38-
* - Field
39-
40-
- Type
41-
42-
- Description
43-
44-
* - ``dataSize``
45-
46-
- string
47-
48-
- The name of the target collection.
49-
50-
51-
52-
* - ``keyPattern``
53-
54-
- document
55-
56-
- Optional. The collection's key pattern to examine.
57-
58-
The collection must have an index with the corresponding pattern.
59-
Otherwise :dbcommand:`dataSize` returns an error message.
60-
61-
62-
63-
* - ``min``
64-
65-
- document
66-
67-
- Optional. The lower bound of the key range to be examined.
68-
69-
70-
71-
* - ``max``
72-
73-
- document
74-
75-
- Optional. The upper bound of the key range to be examined.
76-
77-
78-
79-
* - ``estimate``
80-
81-
- boolean
82-
83-
- Optional. When ``true``, :dbcommand:`dataSize` estimates the data size by
84-
assuming that all documents in the specified range are uniformly
85-
sized as per the collection's average object size. The collection's
86-
average object size is obtained from the ``avgObjSize`` field in
87-
the output of the :dbcommand:`collStats` command.
88-
89-
Defaults to false.
90-
91-
92-
24+
The command has the following syntax:
9325

26+
.. code-block:: javascript
9427

28+
db.runCommand(
29+
{
30+
dataSize: <string>,
31+
keyPattern: <document>,
32+
min: <document>,
33+
max: <document>,
34+
estimate: <boolean>
35+
}
36+
)
37+
38+
Command Fields
39+
--------------
40+
41+
The command takes the following fields:
42+
43+
44+
.. list-table::
45+
:header-rows: 1
46+
:widths: 20 20 80
47+
48+
* - Field
49+
- Type
50+
- Description
51+
52+
* - ``dataSize``
53+
- string
54+
- The name of the target collection.
55+
56+
* - ``keyPattern``
57+
- document
58+
- Optional. The collection's key pattern to examine.
59+
60+
The collection must have an index with the corresponding pattern.
61+
Otherwise :dbcommand:`dataSize` returns an error message.
62+
63+
* - ``min``
64+
- document
65+
- Optional. The lower bound of the key range to be examined.
66+
67+
68+
* - ``max``
69+
- document
70+
- Optional. The upper bound of the key range to be examined.
71+
72+
* - ``estimate``
73+
- boolean
74+
- Optional. When ``true``, :dbcommand:`dataSize` estimates the data size by
75+
assuming that all documents in the specified range are uniformly
76+
sized as per the collection's average object size. The collection's
77+
average object size is obtained from the ``avgObjSize`` field in
78+
the output of the :dbcommand:`collStats` command.
79+
80+
Defaults to false.
81+
9582
Example
9683
-------
9784

source/reference/command/dbHash.txt

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,46 @@ Definition
2020
to compare databases across :binary:`~bin.mongod` instances, such as
2121
across members of replica sets.
2222

23-
:dbcommand:`dbHash` has the following syntax:
23+
Syntax
24+
------
2425

25-
.. code-block:: javascript
26+
The command has the following syntax:
2627

27-
db.runCommand ( { dbHash: 1, collections: [ <collection1>, ... ] } )
28+
.. code-block:: javascript
2829

30+
db.runCommand(
31+
{
32+
dbHash: 1,
33+
collections: [ <collection1>, ... ]
34+
}
35+
)
2936

30-
.. list-table::
31-
:header-rows: 1
32-
:widths: 20 20 80
33-
34-
* - Field
35-
36-
- Type
37-
38-
- Description
39-
40-
* - ``dbHash``
41-
42-
- Any type
43-
44-
- The command to run. Specify any value.
45-
46-
47-
48-
* - ``collections``
49-
50-
- array
51-
52-
- Optional. An array of collection names.
53-
54-
Either specify the collections for which to return the hash values,
55-
or omit or specify an empty array to return the hash values for all
56-
collections in the database.
57-
58-
59-
60-
37+
Command Fields
38+
--------------
6139

40+
The command takes the following fields:
41+
42+
.. list-table::
43+
:header-rows: 1
44+
:widths: 20 20 80
45+
46+
* - Field
47+
- Type
48+
- Description
49+
50+
* - ``dbHash``
51+
- Any type
52+
- The command to run. Specify any value.
53+
54+
* - ``collections``
55+
- array
56+
- Optional. An array of collection names.
57+
58+
Either specify the collections for which to return the hash values,
59+
or omit or specify an empty array to return the hash values for all
60+
collections in the database.
61+
62+
6263
Behavior
6364
--------
6465

source/reference/command/dbStats.txt

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,69 @@ Definition
1616
.. dbcommand:: dbStats
1717

1818
The :dbcommand:`dbStats` command returns storage statistics for a
19-
given database. The command has the following syntax:
20-
21-
.. _scale-argument:
22-
23-
.. code-block:: javascript
24-
25-
db.runCommand( {
26-
dbStats: 1,
27-
scale: <number>,
28-
freeStorage: 0
29-
} )
30-
31-
The :dbcommand:`dbStats` command takes the following fields:
32-
33-
.. list-table::
34-
:header-rows: 1
35-
:widths: 20 80
36-
37-
* - Fields
38-
- Description
39-
40-
* - :dbcommand:`dbStats`
41-
- 1
42-
43-
* - :ref:`scale <dbStats-scale>`
44-
- .. _dbStats-scale:
45-
46-
Optional. The scale factor for the various size data. The
47-
``scale`` defaults to 1 to return size data in bytes. To
48-
display kilobytes rather than bytes, specify a ``scale``
49-
value of ``1024``.
50-
51-
If you specify a non-integer scale factor, MongoDB uses the
52-
integer part of the specified factor. For example, if you
53-
specify a scale factor of ``1023.999``, MongoDB uses ``1023``
54-
as the scale factor.
55-
56-
.. include:: /includes/extracts/4.2-changes-stats-scaleFactor.rst
57-
58-
* - :ref:`freeStorage <dbStats-freeStorage>`
59-
- .. _dbStats-freeStorage:
60-
61-
Optional. To return details on free space allocated to
62-
collections, set ``freeStorage`` to 1.
63-
64-
If the instance has a large number of collections or indexes,
65-
obtaining free space usage data may cause processing delays.
66-
To gather :dbcommand:`dbStats` information without free space
67-
details, either set ``freeStorage`` to 0 or do not include
68-
the field.
69-
70-
In :binary:`~bin.mongosh`, the :method:`db.stats()` function
71-
provides a wrapper around :dbcommand:`dbStats`.
19+
given database.
20+
21+
Syntax
22+
------
23+
24+
The command has the following syntax:
25+
26+
.. _scale-argument:
27+
28+
.. code-block:: javascript
29+
30+
db.runCommand(
31+
{
32+
dbStats: 1,
33+
scale: <number>,
34+
freeStorage: 0
35+
}
36+
)
37+
38+
Command Fields
39+
--------------
40+
41+
The command takes the following fields:
42+
43+
.. list-table::
44+
:header-rows: 1
45+
:widths: 20 80
46+
47+
* - Fields
48+
- Description
49+
50+
* - :dbcommand:`dbStats`
51+
- 1
52+
53+
* - :ref:`scale <dbStats-scale>`
54+
- .. _dbStats-scale:
55+
56+
Optional. The scale factor for the various size data. The
57+
``scale`` defaults to 1 to return size data in bytes. To
58+
display kilobytes rather than bytes, specify a ``scale``
59+
value of ``1024``.
60+
61+
If you specify a non-integer scale factor, MongoDB uses the
62+
integer part of the specified factor. For example, if you
63+
specify a scale factor of ``1023.999``, MongoDB uses ``1023``
64+
as the scale factor.
65+
66+
.. include:: /includes/extracts/4.2-changes-stats-scaleFactor.rst
67+
68+
* - :ref:`freeStorage <dbStats-freeStorage>`
69+
- .. _dbStats-freeStorage:
70+
71+
Optional. To return details on free space allocated to
72+
collections, set ``freeStorage`` to 1.
73+
74+
If the instance has a large number of collections or indexes,
75+
obtaining free space usage data may cause processing delays.
76+
To gather :dbcommand:`dbStats` information without free space
77+
details, either set ``freeStorage`` to 0 or do not include
78+
the field.
79+
80+
In :binary:`~bin.mongosh`, the :method:`db.stats()` function
81+
provides a wrapper around :dbcommand:`dbStats`.
7282

7383
Behavior
7484
--------

0 commit comments

Comments
 (0)