Skip to content

Commit f23eec3

Browse files
authored
(DOCSP-32349) Revamps the expire data page to include Atlas UI (#4827)
* (DOCSP-32349) Revamps the expire data page to include Atlas UI * Includes copy review changes * Includes final copy review changes
1 parent 3bcc1b8 commit f23eec3

File tree

1 file changed

+81
-1
lines changed

1 file changed

+81
-1
lines changed

source/tutorial/expire-data.txt

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ store data in MongoDB and have the :binary:`~bin.mongod` automatically
2222
remove data after a specified number of seconds or at a specific clock
2323
time.
2424

25+
You can expire data for deployments hosted in the following
26+
environments:
27+
28+
.. include:: /includes/fact-environments.rst
29+
2530
Data expiration is useful for some classes of information, including
2631
machine generated event data, logs, and session information that only
2732
need to persist for a limited period of time.
@@ -43,9 +48,83 @@ collection.
4348
You can modify the ``expireAfterSeconds`` of an existing TTL index
4449
using the :dbcommand:`collMod` command.
4550

51+
Expire Documents in the {+atlas+} UI
52+
-------------------------------------------------------
53+
54+
To expire data in the :ref:`Atlas UI <atlas-ui-overview>`, follow
55+
these steps:
56+
57+
.. procedure::
58+
:style: normal
59+
60+
.. step:: Navigate to the collection
61+
62+
a. In the {+atlas+} UI, click :guilabel:`Database` in the sidebar.
63+
#. For the database deployment that contains the data you want to
64+
expire, click :guilabel:`Browse Collections`.
65+
#. In the left navigation pane, select the database.
66+
#. In the left navigation pane, select the collection.
67+
68+
.. step:: Open the :guilabel:`Create Index` modal
69+
70+
a. Click the :guilabel:`Indexes` tab.
71+
#. Click :guilabel:`Create Index`.
72+
73+
.. step:: Create the index with the ``expiresAfterSeconds`` option
74+
75+
a. In the :guilabel:`Fields` section, enter the index key
76+
specification document. For this example, enter the
77+
following text to create an index on the
78+
``expiresAfter`` field:
79+
80+
.. code-block::
81+
82+
{ "expiresAfter": 1 }
83+
84+
b. In the :guilabel:`Options` section, enter the
85+
``expireAfterSeconds`` option. For this example, enter the
86+
following text to expire the data 1 second after the
87+
``expiresAfter`` field's value:
88+
89+
.. code-block::
90+
91+
{ expireAfterSeconds: 1 }
92+
93+
#. Click :guilabel:`Review`.
94+
#. Click :guilabel:`Confirm`.
95+
96+
.. step:: Add a document that contains the ``expiresAfter`` field to the collection
97+
98+
a. In the left navigation pane, select the collection that
99+
contains the index.
100+
#. Click the :guilabel:`Find` tab.
101+
#. Click :guilabel:`Insert Document`.
102+
#. Click the text field under the :guilabel:`_id` field and enter
103+
the field name ``expiresAfter``.
104+
#. Click the text field next to ``expiresAfter`` and enter the
105+
following value:
106+
107+
.. code-block::
108+
109+
2023-10-01T12:00:00.000+00:00
110+
111+
This value expires data after 12:00 on October
112+
1, 2023.
113+
#. Click the data type drop-down menu and change the data type
114+
value to :guilabel:`Date`.
115+
#. Click :guilabel:`Insert`.
116+
117+
The document will expire automatically one second after the
118+
``expiredAfter`` field's value.
119+
120+
The TTL index may take 1-2 seconds to expire the document.
121+
You may need to refresh the UI to see that {+atlas+} deletes
122+
the expired document.
123+
46124
Expire Documents after a Specified Number of Seconds
47125
----------------------------------------------------
48126

127+
You can expire data after a specified number of seconds in the terminal.
49128
To expire data after a specified number of seconds has passed since the
50129
indexed field, create a TTL index on a field that holds values of BSON
51130
date type or an array of BSON date-typed objects *and* specify a
@@ -89,7 +168,8 @@ specified in ``expireAfterSeconds``.
89168
Expire Documents at a Specific Clock Time
90169
-----------------------------------------
91170

92-
To expire documents at a specific clock time, begin by creating a TTL
171+
You can expire data at a specified clock time in the terminal. To
172+
expire documents at a specific clock time, begin by creating a TTL
93173
index on a field that holds values of BSON date type or an array of
94174
BSON date-typed objects *and* specify an ``expireAfterSeconds`` value
95175
of ``0``. For each document in the collection, set the indexed date

0 commit comments

Comments
 (0)