@@ -126,18 +126,39 @@ collection:
126
126
}
127
127
})
128
128
129
+ .. important::
130
+
131
+ Consider the following before updating the ``expireAfterSeconds``
132
+ parameter of a TTL index:
133
+
134
+ - Changing the ``expireAfterSeconds`` parameter **does not** trigger a
135
+ complete index rebuild. However, reducing the ``expireAfterSeconds``
136
+ value can make many documents eligible for immediate deletion,
137
+ potentially causing performance issues due to the increased delete
138
+ operations.
139
+
140
+ - The recommended approach is to manually delete documents in
141
+ small batches before updating the TTL index. This helps control
142
+ the impact on your cluster.
143
+
144
+ - Deleting many documents can fragment storage files, additionally
145
+ impacting performance. You may need to run the
146
+ :ref:`compact <compact>` command on your collection or
147
+ perform a :ref:`replica-set-initial-sync` to reclaim space and
148
+ optimize storage.
149
+
129
150
Behavior
130
151
--------
131
152
132
153
Expiration of Data
133
154
~~~~~~~~~~~~~~~~~~
134
155
135
156
TTL indexes expire documents after the specified number of seconds has
136
- passed since the indexed field value; i.e. the expiration threshold is
137
- the indexed field value plus the specified number of seconds.
157
+ passed since the indexed field value. The expiration threshold is
158
+ the indexed field value plus the specified number of seconds.
138
159
139
160
If the field is an array, and there are multiple date values in the
140
- index, MongoDB uses *lowest* (i.e. earliest) date value in the array to
161
+ index, MongoDB uses *lowest* (earliest) date value in the array to
141
162
calculate the expiration threshold.
142
163
143
164
If the indexed field in a document is not a
0 commit comments