Skip to content

Latest commit

 

History

History
397 lines (143 loc) · 3.4 KB

ChangeStream.md

File metadata and controls

397 lines (143 loc) · 3.4 KB

ChangeStream

Iterator for a change stream.

  • Full name: \MongoDB\ChangeStream
  • This class implements: \Iterator

See Also:

Constants

Constant Visibility Type Value
CURSOR_NOT_FOUND public 43

Properties

cursorNotFound

private static int $cursorNotFound
  • This property is static.

resumableErrorCodes

private static int[] $resumableErrorCodes
  • This property is static.

wireVersionForResumableChangeStreamError

private static int $wireVersionForResumableChangeStreamError
  • This property is static.

resumeCallable

private callable $resumeCallable

iterator

private \MongoDB\Model\ChangeStreamIterator $iterator

key

private int $key

hasAdvanced

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

Methods

current

public current(): mixed

See Also:


getCursorId

public getCursorId(): \MongoDB\Driver\CursorId

getResumeToken

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.


key

public key(): mixed

See Also:


next

public next(): void

See Also:


rewind

public rewind(): void

See Also:


valid

public valid(): bool

See Also:


isResumableError

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:


onIteration

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

resume

Recreates the ChangeStreamIterator after a resumable server error.

private resume(): void

resumeOrThrow

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