发布于 2015-09-14 15:05:40 | 423 次阅读 | 评论: 0 | 来源: 网络整理
$isolated isolation operator isolates a write operation that affects multiple documents from other write operations.
注解
The $isolated isolation operator does not provide “all-or-nothing” atomicity for write operations.
Consider the following example:
db.foo.update( { field1 : 1 , $isolated : 1 }, { $inc : { field2 : 1 } } , { multi: true } )
Without the $isolated operator, multi-updates will allow other operations to interleave with this updates. If these interleaved operations contain writes, the update operation may produce unexpected results. By specifying $isolated you can guarantee isolation for the entire multi-update.
警告
$isolated does not work with sharded clusters.
也可以参考
See db.collection.update() for more information about the db.collection.update() method.