Skip to content

Commit ae95c3b

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

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
@@ -18,6 +18,11 @@ store data in MongoDB and have the :binary:`~bin.mongod` automatically
1818
remove data after a specified number of seconds or at a specific clock
1919
time.
2020

21+
You can expire data for deployments hosted in the following
22+
environments:
23+
24+
.. include:: /includes/fact-environments.rst
25+
2126
Data expiration is useful for some classes of information, including
2227
machine generated event data, logs, and session information that only
2328
need to persist for a limited period of time.
@@ -39,9 +44,83 @@ collection.
3944
You can modify the ``expireAfterSeconds`` of an existing TTL index
4045
using the :dbcommand:`collMod` command.
4146

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

123+
You can expire data after a specified number of seconds in the terminal.
45124
To expire data after a specified number of seconds has passed since the
46125
indexed field, create a TTL index on a field that holds values of BSON
47126
date type or an array of BSON date-typed objects *and* specify a
@@ -85,7 +164,8 @@ specified in ``expireAfterSeconds``.
85164
Expire Documents at a Specific Clock Time
86165
-----------------------------------------
87166

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

0 commit comments

Comments
 (0)