Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\ChangeStream::valid()

Definition

MongoDB\ChangeStream::valid

Returns whether there is a current event in the change stream.

function valid(): boolean

When manually iterating the change stream using Iterator methods, this method should be used to determine if MongoDB\ChangeStream::current() and MongoDB\ChangeStream::key() can be called.

Return Values

A boolean indicating whether there is a current event in the change stream.