Summary摘要
invalidateAn当操作使更改流无效时,会发生invalidateevent occurs when an operation renders the change stream invalid. For example, a change stream opened on a collection that was later dropped or renamed would cause aninvalidateevent.invalidate事件。例如,在集合上打开的更改流后来被删除或重命名,将导致invalidate事件。
Description描述
_id |
| |
clusterTime | Timestamp |
|
operationType |
| |
wallTime | ISODate |
|
Example示例
The following example illustrates an 以下示例说明了invalidate event:invalidate事件:
{
"_id": { <Resume Token> },
"operationType": "invalidate",
"clusterTime": <Timestamp>,
"wallTime": <ISODate>
}
Change streams opened on collections raise an 当发生影响所监视集合的invalidate event when a drop, rename, or dropDatabase operation occurs that affects the watched collection.drop、rename或dropDatabase操作时,在集合上打开的更改流会引发invalidate事件。
Change streams opened on databases raise an 当发生影响所监视数据库的invalidate event when a dropDatabase event occurs that affects the watched database.dropDatabase事件时,在数据库上打开的更改流会引发invalidate事件。
invalidate events close the change stream cursor.事件关闭更改流游标。
You cannot use 在resumeAfter to resume a change stream after an invalidate event (for example, a collection drop or rename) closes the stream. Instead, you can use startAfter to start a new change stream after an invalidate event.invalidate事件(例如,集合删除或重命名)关闭更改流后,您不能使用resumeAfter来恢复更改流。相反,您可以使用startAfter在invalidate事件后启动新的更改流。