Skip to content

Commit e581a8e

Browse files
author
Sam Kleinman
committed
SERVER-2023 touch command documentation
1 parent 93f18db commit e581a8e

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

source/reference/commands.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,40 @@ Collections
12951295
Administration
12961296
~~~~~~~~~~~~~~
12971297

1298+
.. dbcommand:: touch
1299+
1300+
.. versionadded:: 2.2
1301+
1302+
The :dbcommand:`touch` command loads data from the data storage
1303+
layer into memory. :dbcommand:`touch` can load the data
1304+
(i.e. documents,) indexes or both documents and indexes. Use this
1305+
command to ensure that a collection, and/or its indexes, are in
1306+
memory before another operation. :dbcommand:`touch` command has the
1307+
following prototypical form:
1308+
1309+
.. code-block:: javascript
1310+
1311+
{ touch: [collection], data: [boolean], index: [boolean] }
1312+
1313+
By default, ``data`` and ``index`` are false, and
1314+
:dbcommand:`touch` will provide no operation. For example to load
1315+
both the data and the index for a collection named ``records``, you
1316+
would use the following command in the :program:`mongo` shell:
1317+
1318+
.. code-block:: javascript
1319+
1320+
db.runCommand({ touch: "records", data: true, index: true })
1321+
1322+
:dbcommand:`touch` will not block operations on a program:`mongod`,
1323+
:and can run on :term:`secondary` members of replica sets.
1324+
1325+
.. note::
1326+
1327+
Using :dbcommand:`touch` to control or tweak what a
1328+
:program:`mongod` stores in memory may displace other records
1329+
data in memory and hinder performance. Use with caution in
1330+
production systems.
1331+
12981332
.. dbcommand:: fsync
12991333

13001334
:dbcommand:`fsync` is an *administrative command* that forces the

source/release-notes/2.2.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,14 @@ Additional Improvements
372372

373373
:issue:`SERVER-4212`
374374

375+
``touch`` Command
376+
`````````````````
377+
378+
Added the :dbcommand:`touch` command to read the data and/or indexes
379+
from a collection into memory.
380+
381+
See: :issue:`SERVER-2023` and :dbcommand:`touch` for more information.
382+
375383
Tracking i/o Time and Lock Time in Profiler
376384
```````````````````````````````````````````
377385

0 commit comments

Comments
 (0)