Iterator for a change stream.
- Full name:
\MongoDB\ChangeStream
- This class implements:
\Iterator
See Also:
- \MongoDB\Collection::watch() -
- http://docs.mongodb.org/manual/reference/command/changeStream/ -
Constant | Visibility | Type | Value |
---|---|---|---|
CURSOR_NOT_FOUND |
public | 43 |
private static int $cursorNotFound
- This property is static.
private static int[] $resumableErrorCodes
- This property is static.
private static int $wireVersionForResumableChangeStreamError
- This property is static.
private callable $resumeCallable
private \MongoDB\Model\ChangeStreamIterator $iterator
private int $key
Whether the change stream has advanced to its first result. This is used to determine whether $key should be incremented after an iteration event.
private bool $hasAdvanced
public current(): mixed
See Also:
public getCursorId(): \MongoDB\Driver\CursorId
Returns the resume token for the iterator's current position.
public getResumeToken(): array|object|null
Null may be returned if no change documents have been iterated and the server did not include a postBatchResumeToken in its aggregate or getMore command response.
public key(): mixed
See Also:
public next(): void
See Also:
public rewind(): void
See Also:
public valid(): bool
See Also:
Determines if an exception is a resumable error.
private isResumableError(\MongoDB\Driver\Exception\RuntimeException $exception): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$exception |
\MongoDB\Driver\Exception\RuntimeException |
See Also:
Perform housekeeping after an iteration event.
private onIteration(bool $incrementKey): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$incrementKey |
bool | Increment $key if there is a current result |
Recreates the ChangeStreamIterator after a resumable server error.
private resume(): void
Either resumes after a resumable error or re-throws the exception.
private resumeOrThrow(\MongoDB\Driver\Exception\RuntimeException $exception): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$exception |
\MongoDB\Driver\Exception\RuntimeException |