Skip to content

Commit fe95d92

Browse files
committed
DOCSP-14170 clarify TTL index requirements
1 parent 983bead commit fe95d92

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/core/index-ttl.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ of time or at a specific clock time. Data expiration is useful for certain types
2929
like machine generated event data, logs, and session information that
3030
only need to persist in a database for a finite amount of time.
3131

32-
To create a TTL index, use the :method:`db.collection.createIndex()`
33-
method with the ``expireAfterSeconds`` option on a field whose value is
34-
either a :ref:`date <document-bson-type-date>` or an array that
35-
contains :ref:`date values <document-bson-type-date>`.
32+
To create a TTL index, use the :method:`~db.collection.createIndex()`
33+
method on a field whose value is either a :ref:`date
34+
<document-bson-type-date>` or an array that contains :ref:`date values
35+
<document-bson-type-date>`, and specify the ``expireAfterSeconds``
36+
option with the desired TTL value in seconds.
3637

3738
For example, to create a TTL index on the ``lastModifiedDate`` field of
38-
the ``eventlog`` collection, use the following operation in the
39-
:binary:`~bin.mongo` shell:
39+
the ``eventlog`` collection, with a TTL value of ``3600`` seconds, use
40+
the following operation in the :binary:`~bin.mongo` shell:
4041

4142
.. code-block:: javascript
4243

0 commit comments

Comments
 (0)