- Reference >
- Operators >
- Update Operators >
- Isolation Update Operator >
- $isolated
$isolated¶
-
$isolated¶ Prevents a write operation that affects multiple documents from yielding to other reads or writes once the first document is written. By using the
$isolatedoption, you can ensure that no client sees the changes until the operation completes or errors out.This behavior can significantly affect the concurrency of the system as the operation holds the write lock much longer than normal.
Note
The
$isolatedisolation operator does not provide “all-or-nothing” atomicity for write operations.Consider the following example:
Without the
$isolatedoperator, themulti-update operation will allow other operations to interleave with its update of the matched documents.Warning
$isolateddoes not work with sharded clusters.See also