发布于 2015-09-14 15:11:26 | 108 次阅读 | 评论: 0 | 来源: 网络整理

$snapshot

The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document.

Even in snapshot mode, objects inserted or deleted during the lifetime of the cursor may or may not be returned.

The mongo shell provides the cursor.snapshot() method:

db.collection.find().snapshot()

You can also specify the option in either of the following forms:

db.collection.find()._addSpecial( "$snapshot", true )
db.collection.find( { $query: {}, $snapshot: true } )

The $snapshot operator traverses the index on the _id field [1].

警告

[1]You can achieve the $snapshot isolation behavior using any unique index on invariable fields.
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务