diff --git a/source/reference/commands.txt b/source/reference/commands.txt index 423be64d265..0a70948b813 100644 --- a/source/reference/commands.txt +++ b/source/reference/commands.txt @@ -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 diff --git a/source/release-notes/2.2.txt b/source/release-notes/2.2.txt index f214f516963..c4160a3cd5f 100644 --- a/source/release-notes/2.2.txt +++ b/source/release-notes/2.2.txt @@ -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 ```````````````````````````````````````````