diff --git a/doc/changelog.rst b/doc/changelog.rst index e4f928921..d4791bbe7 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -43,7 +43,8 @@ PyMongo 4.7 brings a number of improvements including: creating vector search indexes in MongoDB Atlas. - Fixed a bug where ``read_concern`` and ``write_concern`` were improperly added to :meth:`~pymongo.collection.Collection.list_search_indexes` queries. - +- Deprecated :attr:`pymongo.write_concern.WriteConcern.wtimeout` and :attr:`pymongo.mongo_client.MongoClient.wTimeoutMS`. + Use :meth:`~pymongo.timeout` instead. Unavoidable breaking changes ............................ diff --git a/pymongo/mongo_client.py b/pymongo/mongo_client.py index 100a8340a..3de95a7f5 100644 --- a/pymongo/mongo_client.py +++ b/pymongo/mongo_client.py @@ -439,8 +439,8 @@ class MongoClient(common.BaseObject, Generic[_DocumentType]): primary (e.g. w=3 means write to the primary and wait until replicated to **two** secondaries). Passing w=0 **disables write acknowledgement** and all other write concern options. - - `wTimeoutMS`: (integer) Used in conjunction with `w`. Specify a value - in milliseconds to control how long to wait for write propagation + - `wTimeoutMS`: **DEPRECATED** (integer) Used in conjunction with `w`. + Specify a value in milliseconds to control how long to wait for write propagation to complete. If replication does not complete in the given timeframe, a timeout exception is raised. Passing wTimeoutMS=0 will cause **write operations to wait indefinitely**. @@ -717,6 +717,9 @@ class MongoClient(common.BaseObject, Generic[_DocumentType]): Not:: client.__my_database__ + + .. versionchanged:: 4.7 + Deprecated parameter ``wTimeoutMS``, use :meth:`~pymongo.timeout`. """ doc_class = document_class or dict self.__init_kwargs: dict[str, Any] = { diff --git a/pymongo/write_concern.py b/pymongo/write_concern.py index 2fa9532a3..591a126f8 100644 --- a/pymongo/write_concern.py +++ b/pymongo/write_concern.py @@ -38,9 +38,9 @@ class WriteConcern: replicated to **two** secondaries). **w=0 disables acknowledgement of write operations and can not be used with other write concern options.** - :param wtimeout: (integer) Used in conjunction with `w`. Specify a value - in milliseconds to control how long to wait for write propagation - to complete. If replication does not complete in the given + :param wtimeout: (integer) **DEPRECATED** Used in conjunction with `w`. + Specify a value in milliseconds to control how long to wait for write + propagation to complete. If replication does not complete in the given timeframe, a timeout exception is raised. :param j: If ``True`` block until write operations have been committed to the journal. Cannot be used in combination with `fsync`. Write @@ -51,6 +51,10 @@ class WriteConcern: server is running with journaling, this acts the same as the `j` option, blocking until write operations have been committed to the journal. Cannot be used in combination with `j`. + + + .. versionchanged:: 4.7 + Deprecated parameter ``wtimeout``, use :meth:`~pymongo.timeout`. """ __slots__ = ("__document", "__acknowledged", "__server_default")