change_stream – Watch changes on a collection

ChangeStream cursor to iterate over changes on a collection.

class pymongo.change_stream.ChangeStream(collection, pipeline, full_document, resume_after=None, max_await_time_ms=None, batch_size=None, collation=None, session=None)

A change stream cursor.

Should not be called directly by application developers. Use watch() instead.

See also

The MongoDB documentation on

changeStreams

close()

Close this ChangeStream.

next()

Advance the cursor.

This method blocks until the next change document is returned or an unrecoverable error is raised.

Raises StopIteration if this ChangeStream is closed.