From baa3dd4d02419c776badededf23d47b14426bb19 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 13 Jul 2021 09:39:45 -0700 Subject: [PATCH 1/3] PYTHON-2797 Update changelog for 5.0 support --- README.rst | 2 +- doc/changelog.rst | 24 +++++++++++++++++++++++- pymongo/client_session.py | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 4d8f59257d..612dd9d771 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ is a `gridfs `_ implementation on top of ``pymongo``. -PyMongo supports MongoDB 2.6, 3.0, 3.2, 3.4, 3.6, 4.0, 4.2, and 4.4. +PyMongo supports MongoDB 2.6, 3.0, 3.2, 3.4, 3.6, 4.0, 4.2, 4.4, and 5.0. Support / Feedback ================== diff --git a/doc/changelog.rst b/doc/changelog.rst index 08f8b0046a..3bdddfefb9 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -16,7 +16,17 @@ Changes in Version 3.12.0 Notable improvements .................... +- Added support for MongoDB 5.0. - Support for MongoDB Versioned API, see :class:`~pymongo.server_api.ServerApi`. +- Support for snapshot reads on secondaries (see :ref:`snapshot-reads-ref`). +- Support for Azure and GCP KMS providers for client side field level + encryption. See the docstring for :class:`~pymongo.mongo_client.MongoClient`, + :class:`~pymongo.encryption_options.AutoEncryptionOpts`, + and :mod:`~pymongo.encryption`. +- Support AWS authentication with temporary credentials when connecting to KMS + in client side field level encryption. +- Support for connecting to load balanced MongoDB clusters via the new + ``loadBalanced`` URI option. - Added :attr:`pymongo.mongo_client.MongoClient.topology_description`. - Added hash support to :class:`~pymongo.mongo_client.MongoClient`, :class:`~pymongo.database.Database` and @@ -24,12 +34,21 @@ Notable improvements - Improved the error message returned by :meth:`~pymongo.collection.Collection.insert_many` when supplied with an argument of incorrect type (`PYTHON-1690`_). +- Add session support to :meth:`~pymongo.collection.Collection.find_raw_batches` + and :meth:`~pymongo.collection.Collection.aggregate_raw_batches`. Bug fixes ......... - Fixed a bug that could cause the driver to deadlock during automatic client side field level encryption (`PYTHON-2472`_). +- Fixed a potential deadlock when garbage collecting an unclosed exhaust + :class:`~pymongo.cursor.Cursor`. +- Fixed an bug where using gevent.Timeout to timeout an operation could + lead to a deadlock. +- Fixed the following bug with Atlas Data Lake. When closing cursors, + pymongo now sends killCursors with the namespace returned the cursor's + initial command response. Deprecations ............ @@ -46,7 +65,10 @@ Deprecations - Deprecated :class:`~pymongo.ismaster.IsMaster` and :mod:`~pymongo.ismaster` which will be removed in PyMongo 4.0 and are replaced by :class:`~pymongo.hello.Hello` and :mod:`~pymongo.hello` which provide the - same API. + same API. +- Deprecated the :mod:`pymongo.messeage` module. +- Deprecated the ``ssl_keyfile`` and ``ssl_certfile`` URI options in favor + of ``tlsCertificateKeyFile`` (see :doc:`examples/tls`). .. _PYTHON-2466: https://jira.mongodb.org/browse/PYTHON-2466 .. _PYTHON-1690: https://jira.mongodb.org/browse/PYTHON-1690 diff --git a/pymongo/client_session.py b/pymongo/client_session.py index f8b480084c..0adf588b3f 100644 --- a/pymongo/client_session.py +++ b/pymongo/client_session.py @@ -93,6 +93,8 @@ .. mongodoc:: transactions +.. _snapshot-reads-ref: + Snapshot Reads ============== From f87070df7234e12bf86459e610c32d170fd8743e Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 13 Jul 2021 09:55:18 -0700 Subject: [PATCH 2/3] PYTHON-2797 Find find_raw_batches docs --- doc/api/pymongo/collection.rst | 2 +- doc/changelog.rst | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/pymongo/collection.rst b/doc/api/pymongo/collection.rst index 9e133c9e99..633876d80e 100644 --- a/doc/api/pymongo/collection.rst +++ b/doc/api/pymongo/collection.rst @@ -48,7 +48,7 @@ .. automethod:: aggregate_raw_batches .. automethod:: watch .. automethod:: find(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, modifiers=None, batch_size=0, manipulate=True, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, session=None, allow_disk_use=None) - .. automethod:: find_raw_batches(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, modifiers=None, batch_size=0, manipulate=True, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, allow_disk_use=None) + .. automethod:: find_raw_batches(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, modifiers=None, batch_size=0, manipulate=True, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None, session=None, allow_disk_use=None) .. automethod:: find_one(filter=None, *args, **kwargs) .. automethod:: find_one_and_delete .. automethod:: find_one_and_replace(filter, replacement, projection=None, sort=None, return_document=ReturnDocument.BEFORE, hint=None, session=None, **kwargs) diff --git a/doc/changelog.rst b/doc/changelog.rst index 3bdddfefb9..6f800af318 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -34,7 +34,8 @@ Notable improvements - Improved the error message returned by :meth:`~pymongo.collection.Collection.insert_many` when supplied with an argument of incorrect type (`PYTHON-1690`_). -- Add session support to :meth:`~pymongo.collection.Collection.find_raw_batches` +- Added session and read concern support to + :meth:`~pymongo.collection.Collection.find_raw_batches` and :meth:`~pymongo.collection.Collection.aggregate_raw_batches`. Bug fixes @@ -49,6 +50,9 @@ Bug fixes - Fixed the following bug with Atlas Data Lake. When closing cursors, pymongo now sends killCursors with the namespace returned the cursor's initial command response. +- Fixed a bug in :class:`~pymongo.cursor.RawBatchCursor` that caused it to + return an empty bytestring when the cursor contained no results. It now + raises :exc:`StopIteration` instead. Deprecations ............ From f5e98db2d86ddc45fc2b0ddc276f08d1692bf3cc Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 13 Jul 2021 09:59:53 -0700 Subject: [PATCH 3/3] PYTHON-2797 timeseries --- doc/changelog.rst | 3 +++ pymongo/database.py | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 6f800af318..d8176da0b2 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -27,6 +27,9 @@ Notable improvements in client side field level encryption. - Support for connecting to load balanced MongoDB clusters via the new ``loadBalanced`` URI option. +- Support for creating timeseries collections via the ``timeseries`` and + ``expireAfterSeconds`` arguments to + :meth:`~pymongo.database.Database.create_collection`. - Added :attr:`pymongo.mongo_client.MongoClient.topology_description`. - Added hash support to :class:`~pymongo.mongo_client.MongoClient`, :class:`~pymongo.database.Database` and diff --git a/pymongo/database.py b/pymongo/database.py index 7f6265b4f4..5880c658b7 100644 --- a/pymongo/database.py +++ b/pymongo/database.py @@ -360,14 +360,14 @@ def create_collection(self, name, codec_options=None, Options should be passed as keyword arguments to this method. Supported options vary with MongoDB release. Some examples include: - - "size": desired initial size for the collection (in + - ``size``: desired initial size for the collection (in bytes). For capped collections this size is the max size of the collection. - - "capped": if True, this is a capped collection - - "max": maximum number of objects if capped (optional) - - `timeseries`: a document specifying configuration options for + - ``capped``: if True, this is a capped collection + - ``max``: maximum number of objects if capped (optional) + - ``timeseries``: a document specifying configuration options for timeseries collections - - `expireAfterSeconds`: the number of seconds after which a + - ``expireAfterSeconds``: the number of seconds after which a document in a timeseries collection expires See the MongoDB documentation for a full list of supported options by