Skip to content

Fix inaccurate time series update / delete limitations #6123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions source/core/timeseries/timeseries-limitations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,30 @@ The maximum size of a measurement document is 4 MB.
Updates and Deletes
~~~~~~~~~~~~~~~~~~~

:ref:`Time series collections <manual-timeseries-collection>` support update
and delete operations with limitations. The following operations are not supported
on time series collections:

- :dbcommand:`findAndModify`.
- Updates that modify the ``timeField``.
- Updates with ``multi:false`` that modify the ``metaField``.
- Updates with ``upsert:true``.
- Updates or deletes in multi-document transactions.

MongoDB supports all other update and delete operations. For more information,
see :ref:`<collection-method>`.
Starting in MongoDB 5.1, you can perform some delete and update
operations.

Delete commands must meet the following requirements:

- The query may only match on ``metaField`` field values.
- The delete command may not limit the number of documents to be
deleted. You must use a delete command with ``justOne: false`` or the
:method:`~db.collection.deleteMany()` method.

Update commands must meet the following requirements:

- The query may only match on ``metaField`` field values.
- The update command may only modify the ``metaField`` field value.
- The update must be performed with an update document that contains
only :ref:`update operator <update-operators>` expressions.
- The update command may not limit the number of documents to be
updated. You must use an update command with ``multi: true`` or the
:method:`~db.collection.updateMany()` method.
- The update command may not set :ref:`upsert: true <update-upsert>`.

In MongoDB 5.0, :ref:`Time series collections
<manual-timeseries-collection>` only support insert operations and read
queries. Updates and manual delete operations result in an error.

To automatically delete old data, :ref:`set up automatic removal (TTL)
<set-up-automatic-removal>`.
Expand Down