@@ -447,7 +447,7 @@ def _fix_outgoing(self, son, collection):
447447
448448 def watch (self , pipeline = None , full_document = 'default' , resume_after = None ,
449449 max_await_time_ms = None , batch_size = None , collation = None ,
450- start_at_operation_time = None , session = None ):
450+ start_at_operation_time = None , session = None , start_after = None ):
451451 """Watch changes on this database.
452452
453453 Performs an aggregation with an implicit initial ``$changeStream``
@@ -499,8 +499,10 @@ def watch(self, pipeline=None, full_document='default', resume_after=None,
499499 updates will include both a delta describing the changes to the
500500 document, as well as a copy of the entire document that was
501501 changed from some time after the change occurred.
502- - `resume_after` (optional): The logical starting point for this
503- change stream.
502+ - `resume_after` (optional): A resume token. If provided, the
503+ change stream will start returning changes that occur directly
504+ after the operation specified in the resume token. A resume token
505+ is the _id value of a change document.
504506 - `max_await_time_ms` (optional): The maximum time in milliseconds
505507 for the server to wait for changes before responding to a getMore
506508 operation.
@@ -514,10 +516,16 @@ def watch(self, pipeline=None, full_document='default', resume_after=None,
514516 MongoDB >= 4.0.
515517 - `session` (optional): a
516518 :class:`~pymongo.client_session.ClientSession`.
519+ - `start_after` (optional): The same as `resume_after` except that
520+ `start_after` can resume notifications after an invalidate event.
521+ This option and `resume_after` are mutually exclusive.
517522
518523 :Returns:
519524 A :class:`~pymongo.change_stream.DatabaseChangeStream` cursor.
520525
526+ .. versionchanged:: 3.9
527+ Added the ``start_after`` parameter.
528+
521529 .. versionadded:: 3.7
522530
523531 .. mongodoc:: changeStreams
@@ -527,8 +535,8 @@ def watch(self, pipeline=None, full_document='default', resume_after=None,
527535 """
528536 return DatabaseChangeStream (
529537 self , pipeline , full_document , resume_after , max_await_time_ms ,
530- batch_size , collation , start_at_operation_time , session
531- )
538+ batch_size , collation , start_at_operation_time , session ,
539+ start_after )
532540
533541 def _command (self , sock_info , command , slave_ok = False , value = 1 , check = True ,
534542 allowable_errors = None , read_preference = ReadPreference .PRIMARY ,
0 commit comments