The PyMongo distribution contains tools for interacting with MongoDB
database from Python. The bson package is an implementation of
the BSON format for Python. The pymongo package is a native Python
driver for MongoDB. The gridfs package is a gridfs
implementation on top of pymongo.
Provides
Requires
License
Apache-2.0
Changelog
* Tue Nov 24 2026 Steve Kowalik <steven.kowalik@suse.com>
- Update to 4.20.1:
* Fix getMore commands in load-balanced mode not retrying on retryable
overload errors
* Fix cancelled async commands missing a correlating CommandFailedEvent
before CancelledError propagates
* Sanitize parsing error messages (CVE-2026-129927, bsc#1291084)
* Improve credential validation
* Report detected coding agents in client.env.agent handshake metadata
* Remove beta PREFIXPREVIEW, SUFFIXPREVIEW, and SUBSTRINGPREVIEW query
types in favor of PREFIX, SUFFIX, and SUBSTRING
* Remove deprecated text_opts parameter of encrypt() and TextOpts class
in favor of string_opts and StringOpts
* Align C extension and pure-Python BSON decoders for non-16-byte UUID
subtypes 3 and 4
* Fix MongoClient(maxPoolSize=0, minPoolSize>0) raising ValueError by
treating maxPoolSize=0 as unlimited
* Reject 24-character ObjectId strings containing whitespace with
InvalidId and return False from ObjectId.is_valid()
* Fix Cursor and AsyncCursor let type annotation to Optional[Mapping]
* Disable TLS session reuse on Python 3.11 due to a CPython memory leak
* Fix AsyncMongoClient failing to recover when a replica set member
removes itself from the topology
* Fix signed integer overflow in C extension BSON buffer growth past
1GiB
* Add support for Python 3.15
* Drop support for Python 3.9 and 3.10 (Python 3.11+ now required)
* Remove support for PyPy
* Remove deprecated Algorithm.RANGEPREVIEW and QueryType.RANGEPREVIEW
* Add support for running synchronous and asynchronous clients in
subinterpreters (Python 3.14+)
* Add HTTP proxy support for KMS requests via kms_connect_callback,
HTTPProxyKMSConnect, and AsyncHTTPProxyKMSConnect
* Add srv_host_validator callback argument to MongoClient and
AsyncMongoClient
* Allow srvAllowedHostsSuffix to be a single reserved label (e.g.,
localhost, test, internal)
* Fix synchronous client deadlock under gevent when a greenlet is
killed while returning a connection to the pool
* Compare full DriverInfo for append_metadata() deduplication and
reject '|' delimiters in DriverInfo fields
* Fix driver.name and driver.version '|' alignment and 512-byte
truncation in handshake metadata
* Fix SRV polling failing to update topology when one returned host is
invalid
* Fix C extension BSON decoder accepting documents whose element data
overlaps the document terminator
* Fix pure-Python decode_all() accepting trailing partial documents
instead of raising InvalidBSON
- Use -m build to build the module so we can clean up between builds.
* Tue Sep 29 2026 Daniel Garcia <daniel.garcia@suse.com>
- Update to 4.18.2 (bsc#1282827, bsc#1282845, bsc#1282844):
- Hardened the bson buffer size guard against signed integer
overflow. (CVE-2026-96749)
- Fixed connection string parsing to percent-decode each host
individually. (CVE-2026-96748)
- Client-side field level encryption now rejects a KMS endpoint
ending in .sock. (CVE-2026-96747)
* Mon Sep 14 2026 Nico Krapp <nico.krapp@suse.com>
- Update to 4.18.1 (fixes CVE-2026-88029 (bsc#1280073)):
* Fixed a bug where GridFS delete methods matched the file ID inexactly.
GridFS delete and delete_many now use an exact match for the file ID.
- Update to 4.18.0:
* Dropped support for MongoDB 4.2. Added support for MongoDB 9.0.
* Improved performance for MongoDB 9.0’s Intelligent Workload Management
(IWM) by only retrying overload errors when expected to not worsen
server conditions.
* Added general availability support for Queryable Encryption prefix, suffix,
and substring queries against MongoDB 9.0+(requires libmongocrypt 1.20.0
or later).
* Added srvAllowedHostsSuffix as a URI option and keyword argument to
MongoClient. When connecting via mongodb+srv:// , this option overrides the
default requirement that SRV-returned hosts share the same parent domain as
the seed hostname, allowing hosts under a different domain suffix to be
accepted. The suffix must not be a public suffix (per the Public Suffix
List).
* Improved TLS connection performance by reusing TLS sessions across
connections to the same server.
* PyPy support is deprecated and will be removed in a future release.
* Breaking changes:
* Aggregation helpers now raise ConfigurationError when passed an aggregate
or pipeline keyword argument. Previously these silently replaced the
target namespace and pipeline.
* operation_id is now stable across a logical operation’s retry attempts
and no longer equals the per-attempt request_id.
* Thu Aug 06 2026 Dirk Müller <dmueller@suse.com>
- update to 4.17.0:
* has_key, iterkeys and itervalues in :class:`bson.son.SON`
have been deprecated and will be removed in PyMongo 5.0.
These methods were deprecated in favor of the standard
dictionary containment operator in and the keys() and
values() methods, respectively.
* Added the :meth:`~pymongo.asynchronous.client_session.AsyncCl
ientSession.bind` and
:meth:`~pymongo.client_session.ClientSession.bind` methods
that allow users to bind a session to all database operations
within the scope of a context manager instead of having to
explicitly pass the session to each individual operation. See
the Transactions docs for examples and more information.
* Added support for MongoDB's Intelligent Workload Management
(IWM) and ingress connection rate limiting features. The
driver now gracefully handles write-blocking scenarios and
optimizes connection establishment during high-load
conditions to maintain application availability. See the IWM
or Overload Errors docs for more information.
* Thu Mar 19 2026 Dirk Müller <dmueller@suse.com>
- rely on backports.zstd only on 313 or older
* Sun Mar 08 2026 Dirk Müller <dmueller@suse.com>
- update to 4.16.0:
* Removed invalid documents from
:class:`bson.errors.InvalidDocument` error messages as doing
so may leak sensitive user data. Instead, invalid documents
are stored in :attr:`bson.errors.InvalidDocument.document`.
* PyMongo now requires dnspython>=2.6.1, since dnspython 1.0 is
no longer maintained. The minimum version is 2.6.1 to account
for CVE-2023-29483.
* Removed support for Eventlet. Eventlet is actively being
sunset by its maintainers and has compatibility issues with
PyMongo's dnspython dependency.
* Use Zstandard support from the standard library for Python
3.14+, and use backports.zstd for older versions.
* Fixed return type annotation for find_one_and_* methods on
:class:`~pymongo.asynchronous.collection.AsyncCollection` and
:class:`~pymongo.synchronous.collection.Collection` to
include None.
* Added support for NumPy 1D-arrays in
:class:`bson.binary.BinaryVector`.
* Prevented :class:`~pymongo.encryption.ClientEncryption` from
loading the crypt shared library to fix "MongoCryptError: An
existing crypt_shared library is loaded by the application"
unless the linked library search path is set.
* Sun Dec 28 2025 Dirk Müller <dmueller@suse.com>
- update to 4.15.5:
* Fixed a bug that could cause AutoReconnect("connection pool
paused") errors when cursors fetched more documents from the
database after SDAM heartbeat failures.
* Relaxed the callback type of :meth:`~pymongo.asynchronous.cli
ent_session.AsyncClientSession.with_transaction` to allow the
broader Awaitable type rather than only Coroutine objects.
* Added the missing Python 3.14 trove cl