Skip to content

Commit 81c915b

Browse files
authored
DOCSP-40526 compact dryRun example (#8452)
* compact dryRun example * DOCSP-40526 dryRun example * Title change * Title change * Testing copyable input build * Testing copyable input build * Suggestion per Sarah Olson
1 parent 61bb438 commit 81c915b

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

source/reference/command/compact.txt

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,50 @@ collection, MongoDB returns an error.
293293
Example
294294
-------
295295

296+
Compact a Collection
297+
~~~~~~~~~~~~~~~~~~~~
298+
296299
The following operation runs the ``compact`` command on the
297300
``movies`` collection:
298301

299-
.. code-block:: javascript
302+
.. io-code-block::
303+
:copyable: true
300304

301-
db.runCommand( { compact: "movies" } )
305+
.. input::
306+
:language: javascript
302307

303-
Running ``compact`` returns output similar to the following:
308+
db.runCommand( { compact: "movies" } )
309+
310+
.. output::
311+
:language: javascript
312+
313+
{ bytesFreed: 27859, ok: 1 }
314+
315+
Estimate Compaction
316+
~~~~~~~~~~~~~~~~~~~~
317+
318+
The following operation performs a dry run of the ``compact`` command on the
319+
``movies`` collection:
320+
321+
.. io-code-block::
322+
:copyable: true
323+
324+
.. input::
325+
:language: javascript
326+
327+
db.runCommand( {
328+
compact: "movies",
329+
dryRun: true
330+
} )
331+
332+
.. output::
333+
:language: javascript
334+
335+
{ estimatedBytesFreed: 27859, ok: 1 }
304336

305-
.. code-block:: javascript
306-
:copyable: false
307337

308-
{ bytesFreed: 27859, ok: 1 }
309338

310-
Learn More
339+
Learn More
311340
----------
312341

313342
- :dbcommand:`autoCompact`

0 commit comments

Comments
 (0)