MongoDB\ChangeStream Class

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

MongoDB\ChangeStream Class

New in version 1.3

Definition

This class extends PHP's Iterator interface. An instance of this class is returned by [MongoDB\Client::watch()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-watch.md#mongodb-phpmethod-phpmethod.MongoDB-Client--watch--, [MongoDB\Database::watch()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbdatabase-watch.md#mongodb-phpmethod-phpmethod.MongoDB-Database--watch--, and [MongoDB\Collection::watch().](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbcollection-watch.md#mongodb-phpmethod-phpmethod.MongoDB-Collection--watch--

This class allows for iteration of events in a change stream. It also allows iteration to automatically resume after certain errors, such as a replica set failover.

Methods

  • [MongoDB\ChangeStream::current()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-current.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--current--

  • [MongoDB\ChangeStream::getCursorId()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-getcursorid.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--getCursorId--

  • [MongoDB\ChangeStream::getResumeToken()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-getresumetoken.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--getResumeToken--

  • [MongoDB\ChangeStream::key()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-key.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--key--

  • [MongoDB\ChangeStream::next()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-next.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--next--

  • [MongoDB\ChangeStream::rewind()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-rewind.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--rewind--

  • [MongoDB\ChangeStream::valid()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbchangestream-valid.md#mongodb-phpmethod-phpmethod.MongoDB-ChangeStream--valid--