Definition
MongoDB\ChangeStream::rewind()Rewinds the change stream and attempts to load the first event.
function rewind(): void This method should be called at the start of change stream iteration.
Note
Rewinding the change stream does not guarantee that there will be a current event to access. You should still call
MongoDB\ChangeStream::valid()to check for a current event at each step of iteration. After initially rewinding the change stream,MongoDB\ChangeStream::next()should be used to iterate further.
Errors/Exceptions
MongoDB\Driver\Exception\LogicException if this method is called after a call
to MongoDB\ChangeStream::next() (i.e. the underlying
MongoDB\Driver\Cursor has already been
advanced).
MongoDB\Driver\Exception\RuntimeException for other errors at the extension level (e.g. connection errors).
See Also
Change Streams documentation in the MongoDB manual