Learn what's new in:
What's New in 4.15
The PyMongo v4.15 release includes the following new features:
Adds experimental support for Queryable Encryption prefix, suffix, and substring queries. These features require
pymongocrypt1.16 or later. To learn more about QE, see In-Use Encryption.Note
Experimental Feature
Queryable Encryption prefix, suffix, and substring queries are unstable, and their security is not guaranteed until they're generally available (GA). Use them in experimental workloads only.
Adds support for encoding and decoding BSON
Decimal128values to Pythondecimal.Decimalvalues by using thebson.codec_options.TypeRegistryclass. The following example shows how to encode aDecimal128value to adecimal.Decimalvalue by using thebson.decimal128.DecimalEncoderclass:opts = CodecOptions(type_registry=TypeRegistry([DecimalEncoder()])) bson.encode({"d": decimal.Decimal('1.0')}, codec_options=opts) Adds support for Windows ARM64 wheels.
What's New in 4.14
Warning
Breaking Changes
PyMongo v4.14 contains breaking changes. For more information, see Version 4.14 Breaking Changes.
The PyMongo v4.14 release includes the following new features:
Adds preliminary support for Python 3.14, including free-threading capabilities. The driver doesn't yet support the following features with Python 3.14:
Subinterpreters (
concurrent.interpreters)Free-threading with encryption
mod_wsgi
Removes experimental support for free-threading with Python 3.13.
Adds the following properties to the
bson.codec_options.TypeRegistryclass:.codecs: Provides access to aTypeRegistryobject's type-specific codecs.fallback_encoder: Provides access to aTypeRegistryobject's fallback encoder
Adds the
append_metadata()method to theMongoClientandAsyncMongoClientclasses. You can use this method to send client metadata to the server on demand.Improves server-selection performance when using primary read reference.
What's New in 4.13
The PyMongo v4.13 release includes the following new features:
The PyMongo Async API is generally available. To learn how to migrate to the PyMongo Async API from the PyMongo driver or the Motor library, see the Migrate to PyMongo Async guide.
Fixes a bug where
WriteConcern()could not be evaluated when usingw="majority".
To see a full list of resolved issues in this release, see the Jira release notes.
What's New in 4.12
The PyMongo v4.12 release includes the following new features:
Adds support for configuring DEK cache lifetime by using the
key_expiration_msargument toAutoEncryptionOpts.Adds support for
$lookupin CSFLE and QE for MongoDB Server 8.1 and later.Adds the
gridfs.asynchronous.grid_file.AsyncGridFSBucket.rename_by_name()andgridfs.grid_file.GridFSBucket.rename_by_name()methods. You can use these methods for more performant renaming of files with multiple revisions.Adds the
gridfs.asynchronous.grid_file.AsyncGridFSBucket.delete_by_name()andgridfs.grid_file.GridFSBucket.delete_by_name()methods. You can use these methods for more performant deletion of files with multiple revisions.AsyncMongoClientobjects no longer perform DNS resolution formongodb+srv://connection strings on creation. To avoid blocking theasyncioloop, PyMongo now defers the resolution until the client is first connected.Adds index hinting support to the
pymongo.asynchronous.collection.AsyncCollection.distinct()andpymongo.collection.Collection.distinct()methods.Deprecates the
hedgeparameter for thePrimaryPreferred,Secondary,SecondaryPreferred, andNearestread preferences. Support forhedgewill be removed in PyMongo v5.0.Removes PyOpenSSL support from the PyMongo Async driver.
Allows valid SRV hostnames with fewer than 3 parts.
What's New in 4.11
Warning
Breaking Changes
PyMongo v4.11 contains breaking changes. For more information, see Version 4.11 Breaking Changes.
The PyMongo v4.11 release includes the following new features:
Adds support for free-threaded CPython when running Python v3.13+. For more information about free threading, see the Python documentation.
In-use encryption requires
pymongocryptv1.12 or later.The
MongoClient.address()andAsyncMongoClient.address()methods correctly block when called on unconnected clients.Adds
__repr__support for theIndexModelandSearchIndexModelclasses.Adds a
sortparameter to the following methods:Collection.update_one()Collection.replace_one()operations.UpdateOne()operations.UpdateMany()
The
MongoClient.bulkWrite()andAsyncMongoClient.bulk_write()methods throw an error error if you use them with unacknowledged writes when theorderedorverboseResultsoptions are set toTrue.Fixes a bug that caused
DatetimeMSto be incorrectly encoded as'{"$date": "X"}'instead of'{"$date": X}'when using the the legacy MongoDB Extended JSON datetime representation.Fixes a bug that caused the
bson.json_util.loads()method to raise anIndexErrorinstead of aValueErrorwhen parsing an invalid$datevalue.
What's New in 4.10
The PyMongo v4.10 release includes the following new features:
Adds provisional support for a new binary BSON subtype (9), which can be used for efficient storage and retrieval of vectors by using the
bson.binary.Binary.from_vector()andbson.binary.Binary.as_vector()methods. Support for BSON subtype 9 is in beta and is subject to change before the generally available release.Adds
"c"to thedriver.nameclient metadata field when an application uses the C extension.Fixes a bug that could cause
AsyncMongoClientto deadlock.
What's New in 4.9
Warning
Breaking Changes
PyMongo v4.9 contains breaking changes. For more information, see Version 4.9 Breaking Changes.
The PyMongo v4.9 release includes the following new features:
Adds support for MongoDB Server 8.0 and Python 3.13.
Adds support for Queryable Encryption range queries. To use this feature, your app must connect to MongoDB Server 8.0 or later. For more information about Queryable Encryption, see Queryable Encryption in the MongoDB Server manual.
Adds a new experimental asynchronous API as a replacement for Motor. This API is in beta and is subject to change before the generally available release.
What's New in 4.8
Warning
Breaking Changes
PyMongo v4.8 contains breaking changes. For more information, see Version 4.8 Breaking Changes.
The PyMongo v4.8 release includes the following new features:
Implemented Secure Software Development Life Cycle (SSDLC) automation in the release process. GitHub releases include a software bill of materials (SBOM) and signature files corresponding to the distribution files released on PyPI.
In objects of type
bson.binary.Binary, therepr()method is redacted when the binary subtype isSENSITIVE_SUBTYPE(8).Fixed a bug in change streams where both the
startAtOperationTimeandresumeTokenfields could be added to a retry attempt, which caused the retry to fail.On Windows, changed handshake metadata for
os.nametoWindowsto improve import time.Improved performance of
MongoClientoperations, especially when the driver is running many operations concurrently.Added a fallback to the stdlib
sslmodule if importing thepyopensslmodule fails with anAttributeError.
What's New in 4.7
Warning
Breaking Changes
PyMongo v4.7 contains breaking changes. For more information, see Version 4.7 Breaking Changes.
The PyMongo v4.7 release includes the following new features:
Added the
Hello.connection_id, CommandStartedEvent.server_connection_id, CommandSucceededEvent.server_connection_id, and CommandFailedEvent.server_connection_id properties.Added support for name suffixes for Key Management Service (KMS) providers for Client-Side Field Level Encryption (CSFLE). This feature requires
pymongocryptv1.9+ andlibmongocryptv1.9+. For more information, see the API documentation for the AutoEncryptionOpts class.Improved the performance of encoding BSON documents to JSON.
The
ClientEncryption.encrypt()andClientEncryption.encrypt_expression()methods now allow thekey_idargument to be passed in as aUUIDObject.Inflating a
RawBSONDocumentobject containing aCodevalue no longer causes an error.Fixed a bug in Python 3.12 where the error message
RuntimeError: can't create new thread at interpreter shutdowncould be written tostderrwhen aMongoClientthread starts as the Python interpreter is shutting down.Fixed a bug where
Int64instances could not always be encoded by orjson. Code like the following example now runs correctly:
import orjson from bson import json_util orjson.dumps({'a': Int64(1)}, default=json_util.default, option=orjson.OPT_PASSTHROUGH_SUBCLASS)