Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions source/reference/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,40 @@ Collections
Administration
~~~~~~~~~~~~~~

.. dbcommand:: touch

.. versionadded:: 2.2

The :dbcommand:`touch` command loads data from the data storage
layer into memory. :dbcommand:`touch` can load the data
(i.e. documents,) indexes or both documents and indexes. Use this
command to ensure that a collection, and/or its indexes, are in
memory before another operation. :dbcommand:`touch` command has the
following prototypical form:

.. code-block:: javascript

{ touch: [collection], data: [boolean], index: [boolean] }

By default, ``data`` and ``index`` are false, and
:dbcommand:`touch` will provide no operation. For example to load
both the data and the index for a collection named ``records``, you
would use the following command in the :program:`mongo` shell:

.. code-block:: javascript

db.runCommand({ touch: "records", data: true, index: true })

:dbcommand:`touch` will not block operations on a program:`mongod`,
:and can run on :term:`secondary` members of replica sets.

.. note::

Using :dbcommand:`touch` to control or tweak what a
:program:`mongod` stores in memory may displace other records
data in memory and hinder performance. Use with caution in
production systems.

.. dbcommand:: fsync

:dbcommand:`fsync` is an *administrative command* that forces the
Expand Down
8 changes: 8 additions & 0 deletions source/release-notes/2.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ Additional Improvements

:issue:`SERVER-4212`

``touch`` Command
`````````````````

Added the :dbcommand:`touch` command to read the data and/or indexes
from a collection into memory.

See: :issue:`SERVER-2023` and :dbcommand:`touch` for more information.

Tracking i/o Time and Lock Time in Profiler
```````````````````````````````````````````

Expand Down