change_stream
– Watch changes on a collection¶
ChangeStream cursor to iterate over changes on a collection.
-
class
pymongo.change_stream.
ChangeStream
(target, pipeline, full_document, resume_after, max_await_time_ms, batch_size, collation, start_at_operation_time, session)¶ The internal abstract base class for change stream cursors.
Should not be called directly by application developers. Use :meth:pymongo.collection.Collection.watch, :meth:pymongo.database.Database.watch, or :meth:pymongo.mongo_client.MongoClient.watch instead.
Defines the interface for change streams. Should be subclassed to implement the ChangeStream._create_cursor abstract method, and the ChangeStream._database`and ChangeStream._aggregation_target abstract properties.
-
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.
-
-
class
pymongo.change_stream.
ClusterChangeStream
(target, pipeline, full_document, resume_after, max_await_time_ms, batch_size, collation, start_at_operation_time, session)¶ Class for creating a change stream on all collections on a cluster.
Should not be called directly by application developers. Use helper method
pymongo.mongo_client.MongoClient.watch()
instead.
-
class
pymongo.change_stream.
CollectionChangeStream
(target, pipeline, full_document, resume_after, max_await_time_ms, batch_size, collation, start_at_operation_time, session)¶ Class for creating a change stream on a collection.
Should not be called directly by application developers. Use helper method
pymongo.collection.Collection.watch()
instead.
-
class
pymongo.change_stream.
DatabaseChangeStream
(target, pipeline, full_document, resume_after, max_await_time_ms, batch_size, collation, start_at_operation_time, session)¶ Class for creating a change stream on all collections in a database.
Should not be called directly by application developers. Use helper method
pymongo.database.Database.watch()
instead.