You are viewing an offline version of MongoDB documentation. Some page features might be unavailable. To view the latest version of the page or use interactive features, visit the live page.
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()andMongoDB\ChangeStream::key()can be called.
Return Values
A boolean indicating whether there is a current event in the change stream.
See Also
Change Streams documentation in the MongoDB manual