File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,15 @@ of time or at a specific clock time. Data expiration is useful for certain types
2929like machine generated event data, logs, and session information that
3030only 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
3738For 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
You can’t perform that action at this time.
0 commit comments