Skip to content

Latest commit

 

History

History
4187 lines (3378 loc) · 188 KB

changelog.rst

File metadata and controls

4187 lines (3378 loc) · 188 KB

Changelog

Changes in Version 4.11.0 (YYYY/MM/DD)

Warning

PyMongo 4.11 drops support for Python 3.8: Python 3.9+ or PyPy 3.9+ is now required.

Warning

PyMongo 4.11 drops support for MongoDB 3.6. PyMongo now supports MongoDB 4.0+. Driver support for MongoDB 3.6 reached end of life in April 2024.

PyMongo 4.11 brings a number of changes including:

Issues Resolved

See the PyMongo 4.11 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.10.1 (2024/10/01)

Version 4.10.1 is a bug fix release.

Issues Resolved

See the PyMongo 4.10.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.10.0 (2024/09/30)

Issues Resolved

See the PyMongo 4.10 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.9.2 (2024/10/02)

Issues Resolved

See the PyMongo 4.9.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.9.1 (2024/09/18)

  • Add missing documentation about the fact the async API is in beta state.

Issues Resolved

See the PyMongo 4.9.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.9 (2024/09/18)

Warning

Driver support for MongoDB 3.6 reached end of life in April 2024. PyMongo 4.9 will be the last release to support MongoDB 3.6.

Warning

PyMongo 4.9 refactors a large portion of internal APIs to support the new asynchronous API beta. As a result, versions of Motor older than 3.6 are not compatible with PyMongo 4.9. Existing users of these versions must either upgrade to Motor 3.6 and PyMongo 4.9, or cap their PyMongo version to < 4.9. Any applications that use private APIs may also break as a result of these internal changes.

PyMongo 4.9 brings a number of improvements including:

Issues Resolved

See the PyMongo 4.9 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.8.0 (2024/06/26)

Warning

PyMongo 4.8 drops support for Python 3.7 and PyPy 3.8: Python 3.8+ or PyPy 3.9+ is now required.

PyMongo 4.8 brings a number of improvements including:

  • The handshake metadata for "os.name" on Windows has been simplified to "Windows" to improve import time.
  • The repr of bson.binary.Binary is now redacted when the subtype is SENSITIVE_SUBTYPE(8).
  • Secure Software Development Life Cycle automation for release process. GitHub Releases now include a Software Bill of Materials, and signature files corresponding to the distribution files released on PyPI.
  • Fixed a bug in change streams where both startAtOperationTime and resumeToken could be added to a retry attempt, which caused the retry to fail.
  • Fallback to stdlib ssl module when pyopenssl import fails with AttributeError.
  • Improved performance of MongoClient operations, especially when many operations are being run concurrently.

Unavoidable breaking changes

  • Since we are now using hatch as our build backend, we no longer have a usable setup.py file and require installation using pip. Attempts to invoke the setup.py file will raise an exception. Additionally, pip >= 21.3 is now required for editable installs.
  • We no longer support the srv extra, since dnspython is included as a dependency in PyMongo 4.7+. Instead of pip install pymongo[srv], use pip install pymongo.
  • We no longer support the tls extra, which was only valid for Python 2. Instead of pip install pymongo[tls], use pip install pymongo.

Issues Resolved

See the PyMongo 4.8 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.7.3 (2024/06/04)

Version 4.7.3 has further fixes for lazily loading modules.

  • Use deferred imports instead of importlib lazy module loading.
  • Improve import time on Windows.
  • Reduce verbosity of "Waiting for suitable server to become available" log message from info to debug.

Issues Resolved

See the PyMongo 4.7.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.7.2 (2024/05/07)

Version 4.7.2 fixes a bug introduced in 4.7.0:

  • Fixed a bug where PyMongo could not be used with the Nuitka compiler.

Issues Resolved

See the PyMongo 4.7.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.7.1 (2024/04/30)

Version 4.7.1 fixes a bug introduced in 4.7.0:

  • Fixed a bug where PyMongo would cause an AttributeError if dns.resolver was imported and referenced after PyMongo was imported.
  • Clarified the behavior of the TOKEN_RESOURCE auth mechanism property for MONGODB-OIDC.

Issues Resolved

See the PyMongo 4.7.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.7.0 (2024/04/24)

PyMongo 4.7 brings a number of improvements including:

Warning

PyMongo depends on dnspython, which released version 2.6.1 with a fix for CVE-2023-29483. We do not explicitly require that version, but we strongly recommend that you install at least that version in your environment.

Unavoidable breaking changes

  • Replaced usage of :class:`bson.son.SON` on all internal classes and commands to dict, :attr:`options.pool_options.metadata` is now of type dict as opposed to :class:`bson.son.SON`. Here's some examples of how this changes expected output as well as how to convert from :class:`dict` to :class:`bson.son.SON`:

    # Before
    >>> from pymongo import MongoClient
    >>> client = MongoClient()
    >>> client.options.pool_options.metadata
    SON([('driver', SON([('name', 'PyMongo'), ('version', '4.7.0.dev0')])), ('os', SON([('type', 'Darwin'), ('name', 'Darwin'), ('architecture', 'arm64'), ('version', '14.3')])), ('platform', 'CPython 3.11.6.final.0')])
    
    # After
    >>> client.options.pool_options.metadata
    {'driver': {'name': 'PyMongo', 'version': '4.7.0.dev0'}, 'os': {'type': 'Darwin', 'name': 'Darwin', 'architecture': 'arm64', 'version': '14.3'}, 'platform': 'CPython 3.11.6.final.0'}
    
    # To convert from dict to SON
    # This will only convert the first layer of the dictionary
    >>> data_as_dict = client.options.pool_options.metadata
    >>> SON(data_as_dict)
    SON([('driver', {'name': 'PyMongo', 'version': '4.7.0.dev0'}), ('os', {'type': 'Darwin', 'name': 'Darwin', 'architecture': 'arm64', 'version': '14.3'}), ('platform', 'CPython 3.11.6.final.0')])
    
    # To convert from dict to SON on a nested dictionary
    >>> def dict_to_SON(data_as_dict: dict[Any, Any]):
    ...     data_as_SON = SON()
    ...     for key, value in data_as_dict.items():
    ...         data_as_SON[key] = dict_to_SON(value) if isinstance(value, dict) else value
    ...     return data_as_SON
    >>>
    >>> dict_to_SON(data_as_dict)
    SON([('driver', SON([('name', 'PyMongo'), ('version', '4.7.0.dev0')])), ('os', SON([('type', 'Darwin'), ('name', 'Darwin'), ('architecture', 'arm64'), ('version', '14.3')])), ('platform', 'CPython 3.11.6.final.0')])
    
  • PyMongo now uses lazy imports for external dependencies. If you are relying on any kind of monkey-patching of the standard library, you may need to explicitly import those external libraries in addition to pymongo before applying the patch. Note that we test with gevent and eventlet patching, and those continue to work.

  • The "aws" extra now requires minimum version of 1.1.0 for pymongo_auth_aws.

Changes in Version 4.6.3 (2024/03/27)

PyMongo 4.6.3 fixes the following bug:

  • Fixed a potential memory access violation when decoding invalid bson.

Issues Resolved

See the PyMongo 4.6.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.6.2 (2024/02/21)

PyMongo 4.6.2 fixes the following bug:

  • Fixed a bug appearing in Python 3.12 where "RuntimeError: can't create new thread at interpreter shutdown" could be written to stderr when a MongoClient's thread starts as the python interpreter is shutting down.

Issues Resolved

See the PyMongo 4.6.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.6.1 (2023/11/29)

PyMongo 4.6.1 fixes the following bug:

  • Ensure retryable read OperationFailure errors re-raise exception when 0 or NoneType error code is provided.

Issues Resolved

See the PyMongo 4.6.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.6.0 (2023/11/01)

PyMongo 4.6 brings a number of improvements including:

Issues Resolved

See the PyMongo 4.6 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.5.0 (2023/08/22)

PyMongo 4.5 brings a number of improvements including:

Warning

PyMongo no longer supports PyPy3 versions older than 3.8. Users must upgrade to PyPy3.8+.

Issues Resolved

See the PyMongo 4.5 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.4.1 (2023/07/13)

Version 4.4.1 fixes the following bugs:

  • Fixed a bug where pymongo would raise a ConfigurationError: Invalid SRV host error when connecting to a "mongodb+srv://" URI that included capital letters in the SRV hosts returned from DNS. (PYTHON-3800).
  • Fixed a minor reference counting bug in the C extension (PYTHON-3798).

Issues Resolved

See the PyMongo 4.4.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.4.0 (2023/06/21)

PyMongo 4.4 brings a number of improvements including:

Issues Resolved

See the PyMongo 4.4 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.3.3 (2022/11/17)

Version 4.3.3 documents support for the following:

Bug Fixes

Issues Resolved

See the PyMongo 4.3.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.3.2 (2022/10/18)

Note: We withheld uploading tags 4.3.0 and 4.3.1 to PyPI due to a version handling error and a necessary documentation update.

dnspython is now a required dependency. This change makes PyMongo easier to install for use with "mongodb+srv://" connection strings and MongoDB Atlas.

PyMongo 4.3 brings a number of improvements including:

Bug fixes

Issues Resolved

See the PyMongo 4.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.2.0 (2022/07/20)

Warning

PyMongo 4.2 drops support for Python 3.6: Python 3.7+ is now required.

PyMongo 4.2 brings a number of improvements including:

Bug fixes

Unavoidable breaking changes

Issues Resolved

See the PyMongo 4.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.1.1 (2022/04/13)

Version 4.1.1 fixes a number of bugs:

  • Fixed a memory leak bug when calling :func:`~bson.decode_all` without a codec_options argument (PYTHON-3222).
  • Fixed a bug where :func:`~bson.decode_all` did not accept codec_options as a keyword argument (PYTHON-3222).
  • Fixed an oversight where type markers (py.typed files) were not included in our release distributions (PYTHON-3214).
  • Fixed a bug where pymongo would raise a "NameError: name sys is not defined" exception when attempting to parse a "mongodb+srv://" URI when the dnspython dependency was not installed (PYTHON-3198).

Issues Resolved

See the PyMongo 4.1.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.1 (2021/12/07)

Warning

PyMongo 4.1 drops support for Python 3.6.0 and 3.6.1, Python 3.6.2+ is now required.

PyMongo 4.1 brings a number of improvements including:

Bug fixes

Issues Resolved

See the PyMongo 4.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 4.0.2 (2022/03/03)

  • No changes

Changes in Version 4.0.1 (2021/12/07)

  • No changes

Changes in Version 4.0 (2021/11/29)

Warning

PyMongo 4.0 drops support for Python 2.7, 3.4, and 3.5.

Warning

PyMongo 4.0 drops support for MongoDB 2.6, 3.0, 3.2, and 3.4.

Warning

PyMongo 4.0 changes the default value of the directConnection URI option and keyword argument to :class:`~pymongo.mongo_client.MongoClient` to False instead of None, allowing for the automatic discovery of replica sets. This means that if you want a direct connection to a single server you must pass directConnection=True as a URI option or keyword argument. For more details, see the relevant section of the PyMongo 4.x migration guide: :ref:`pymongo4-migration-direct-connection`.

PyMongo 4.0 brings a number of improvements as well as some backward breaking changes. For example, all APIs deprecated in PyMongo 3.X have been removed. Be sure to read the changes listed below and the :doc:`migrate-to-pymongo4` before upgrading from PyMongo 3.x.

Breaking Changes in 4.0

Notable improvements

Issues Resolved

See the PyMongo 4.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.13.0 (2022/11/01)

Version 3.13 provides an upgrade path to PyMongo 4.x. Most of the API changes from PyMongo 4.0 have been backported in a backward compatible way, allowing applications to be written against PyMongo >= 3.13, rather then PyMongo 3.x or PyMongo 4.x. See the PyMongo 4 Migration Guide for detailed examples.

Notable improvements

Issues Resolved

PyMongo 3.13 drops support for Python 3.4.

Bug fixes

Deprecations

can be changed to this:

doc = client.admin.command('hello')
max_bson_size = doc['maxBsonObjectSize']
max_message_size = doc['maxMessageSizeBytes']
max_write_batch_size = doc['maxWriteBatchSize']

See the PyMongo 3.13.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.12.3 (2021/12/07)

Issues Resolved

Version 3.12.3 fixes a bug that prevented :meth:`bson.json_util.loads` from decoding a document with a non-string "$regex" field (PYTHON-3028).

See the PyMongo 3.12.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.12.2 (2021/11/29)

Issues Resolved

Version 3.12.2 fixes a number of bugs:

  • Fixed a bug that prevented PyMongo from retrying bulk writes after a writeConcernError on MongoDB 4.4+ (PYTHON-2984).
  • Fixed a bug that could cause the driver to hang during automatic client side field level encryption (PYTHON-3017).

See the PyMongo 3.12.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.12.1 (2021/10/19)

Issues Resolved

Version 3.12.1 fixes a number of bugs:

  • Fixed a bug that caused a multi-document transaction to fail when the first operation was large bulk write (>48MB) that required splitting a batched write command (PYTHON-2915).
  • Fixed a bug that caused the tlsDisableOCSPEndpointCheck URI option to be applied incorrectly (PYTHON-2866).

See the PyMongo 3.12.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.12.0 (2021/07/13)

Warning

PyMongo 3.12.0 deprecates support for Python 2.7, 3.4 and 3.5. These Python versions will not be supported by PyMongo 4.

Warning

PyMongo now allows insertion of documents with keys that include dots ('.') or start with dollar signs ('$').

  • pymongocrypt 1.1.0 or later is now required for client side field level encryption support.
  • Iterating over :class:`gridfs.grid_file.GridOut` now moves through the file line by line instead of chunk by chunk, and does not restart at the top for subsequent iterations on the same object. Call seek(0) to reset the iterator.

Notable improvements

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.
  • 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

Issues Resolved

See the PyMongo 3.12.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.11.3 (2021/02/02)

Issues Resolved

Version 3.11.3 fixes a bug that prevented PyMongo from retrying writes after a writeConcernError on MongoDB 4.4+ (PYTHON-2452)

See the PyMongo 3.11.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.11.2 (2020/12/02)

Issues Resolved

Version 3.11.2 includes a number of bugfixes. Highlights include:

See the PyMongo 3.11.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.11.1 (2020/11/17)

Version 3.11.1 adds support for Python 3.9 and includes a number of bugfixes. Highlights include:

Issues Resolved

See the PyMongo 3.11.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.11.0 (2020/07/30)

Version 3.11 adds support for MongoDB 4.4 and includes a number of bug fixes. Highlights include:

Deprecations:

Unavoidable breaking changes:

Issues Resolved

See the PyMongo 3.11.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.10.1 (2020/01/07)

Version 3.10.1 fixes the following issues discovered since the release of 3.10.0:

Issues Resolved

See the PyMongo 3.10.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.10.0 (2019/12/10)

Version 3.10 includes a number of improvements and bug fixes. Highlights include:

  • Support for Client-Side Field Level Encryption with MongoDB 4.2. See :doc:`examples/encryption` for examples.
  • Support for Python 3.8.
  • Added :attr:`pymongo.client_session.ClientSession.in_transaction`.
  • Do not hold the Topology lock while creating connections in a MongoClient's background thread. This change fixes a bug where application operations would block while the background thread ensures that all server pools have minPoolSize connections.
  • Fix a UnicodeDecodeError bug when coercing a PyMongoError with a non-ascii error message to unicode on Python 2.
  • Fix an edge case bug where PyMongo could exceed the server's maxMessageSizeBytes when generating a compressed bulk write command.

Issues Resolved

See the PyMongo 3.10 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.9.0 (2019/08/13)

Version 3.9 adds support for MongoDB 4.2. Highlights include:

Unavoidable breaking changes:

  • Applications that use MongoDB with the MMAPv1 storage engine must now explicitly disable retryable writes via the connection string (e.g. MongoClient("mongodb://my.mongodb.cluster/db?retryWrites=false")) or the :class:`~pymongo.mongo_client.MongoClient` constructor's keyword argument (e.g. MongoClient("mongodb://my.mongodb.cluster/db", retryWrites=False)) to avoid running into :class:`~pymongo.errors.OperationFailure` exceptions during write operations. The MMAPv1 storage engine is deprecated and does not support retryable writes which are now turned on by default.
  • In order to ensure that the connectTimeoutMS URI option is honored when connecting to clusters with a mongodb+srv:// connection string, the minimum required version of the optional dnspython dependency has been bumped to 1.16.0. This is a breaking change for applications that use PyMongo's SRV support with a version of dnspython older than 1.16.0.

Issues Resolved

See the PyMongo 3.9 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.8.0 (2019/04/22)

Warning

PyMongo no longer supports Python 2.6. RHEL 6 users should install Python 2.7 or newer from Red Hat Software Collections. CentOS 6 users should install Python 2.7 or newer from SCL

Warning

PyMongo no longer supports PyPy3 versions older than 3.5. Users must upgrade to PyPy3.5+.

Unavoidable breaking changes:

  • In order to follow the ObjectID Spec version 0.2, an ObjectId's 3-byte machine identifier and 2-byte process id have been replaced with a single 5-byte random value generated per process. This is a breaking change for any application that attempts to interpret those bytes.

Issues Resolved

See the PyMongo 3.8 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.7.2 (2018/10/10)

Version 3.7.2 fixes a few issues discovered since the release of 3.7.1.

Issues Resolved

See the PyMongo 3.7.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.7.1 (2018/07/16)

Version 3.7.1 fixes a few issues discovered since the release of 3.7.0.

  • Calling :meth:`~pymongo.database.Database.authenticate` more than once with the same credentials results in OperationFailure.
  • Authentication fails when SCRAM-SHA-1 is used to authenticate users with only MONGODB-CR credentials.
  • A millisecond rounding problem when decoding datetimes in the pure Python BSON decoder on 32 bit systems and AWS lambda.

Issues Resolved

See the PyMongo 3.7.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.7.0 (2018/06/26)

Version 3.7 adds support for MongoDB 4.0. Highlights include:

Deprecations:

Unavoidable breaking changes:

  • Commands that fail with server error codes 10107, 13435, 13436, 11600, 11602, 189, 91 (NotMaster, NotMasterNoSlaveOk, NotMasterOrSecondary, InterruptedAtShutdown, InterruptedDueToReplStateChange, PrimarySteppedDown, ShutdownInProgress respectively) now always raise :class:`~pymongo.errors.NotMasterError` instead of :class:`~pymongo.errors.OperationFailure`.
  • :meth:`~pymongo.collection.Collection.parallel_scan` no longer uses an implicit session. Explicit sessions are still supported.
  • Unacknowledged writes (w=0) with an explicit session parameter now raise a client side error. Since PyMongo does not wait for a response for an unacknowledged write, two unacknowledged writes run serially by the client may be executed simultaneously on the server. However, the server requires a single session must not be used simultaneously by more than one operation. Therefore explicit sessions cannot support unacknowledged writes. Unacknowledged writes without a session parameter are still supported.

Issues Resolved

See the PyMongo 3.7 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.6.1 (2018/03/01)

Version 3.6.1 fixes bugs reported since the release of 3.6.0:

Issues Resolved

See the PyMongo 3.6.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.6.0 (2017/08/23)

Version 3.6 adds support for MongoDB 3.6, drops support for CPython 3.3 (PyPy3 is still supported), and drops support for MongoDB versions older than 2.6. If connecting to a MongoDB 2.4 server or older, PyMongo now throws a :exc:`~pymongo.errors.ConfigurationError`.

Highlights include:

Deprecations:

Unavoidable breaking changes:

Issues Resolved

See the PyMongo 3.6 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.5.1 (2017/08/23)

Version 3.5.1 fixes bugs reported since the release of 3.5.0:

Issues Resolved

See the PyMongo 3.5.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.5.0 (2017/08/08)

Version 3.5 implements a number of improvements and bug fixes:

Highlights include:

Changes and Deprecations:

Issues Resolved

See the PyMongo 3.5 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.4.0 (2016/11/29)

Version 3.4 implements the new server features introduced in MongoDB 3.4 and a whole lot more:

Highlights include:

Warning

Starting in PyMongo 3.4, :attr:`bson.code.Code.scope` may return None, as the default scope is None instead of {}.

Note

PyMongo 3.4+ attempts to create sockets non-inheritable when possible (i.e. it sets the close-on-exec flag on socket file descriptors). Support is limited to a subset of POSIX operating systems (not including Windows) and the flag usually cannot be set in a single atomic operation. CPython 3.4+ implements PEP 446, creating all file descriptors non-inheritable by default. Users that require this behavior are encouraged to upgrade to CPython 3.4+.

Since 3.4rc0, the max staleness option has been renamed from maxStalenessMS to maxStalenessSeconds, its smallest value has changed from twice heartbeatFrequencyMS to 90 seconds, and its default value has changed from None or 0 to -1.

Issues Resolved

See the PyMongo 3.4 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.3.1 (2016/10/27)

Version 3.3.1 fixes a memory leak when decoding elements inside of a :class:`~bson.raw_bson.RawBSONDocument`.

Issues Resolved

See the PyMongo 3.3.1 release notes in Jira for the list of resolved issues in this release.

Changes in Version 3.3.0 (2016/07/12)

Version 3.3 adds the following major new features:

  • C extensions support on big endian systems.
  • Kerberos authentication support on Windows using WinKerberos.
  • A new ssl_clrfile option to support certificate revocation lists.
  • A new ssl_pem_passphrase option to support encrypted key files.
  • Support for publishing server discovery and monitoring events. See :mod:`~pymongo.monitoring` for details.
  • New connection pool options minPoolSize and maxIdleTimeMS.
  • New heartbeatFrequencyMS option controls the rate at which background monitoring threads re-check servers. Default is once every 10 seconds.

Warning

PyMongo 3.3 drops support for MongoDB versions older than 2.4. It also drops support for python 3.2 (pypy3 continues to be supported).

Issues Resolved

See the PyMongo 3.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.2.2 (2016/03/15)

Version 3.2.2 fixes a few issues reported since the release of 3.2.1, including a fix for using the connect option in the MongoDB URI and support for setting the batch size for a query to 1 when using MongoDB 3.2+.

Issues Resolved

See the PyMongo 3.2.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.2.1 (2016/02/02)

Version 3.2.1 fixes a few issues reported since the release of 3.2, including running the mapreduce command twice when calling the :meth:`~pymongo.collection.Collection.inline_map_reduce` method and a :exc:`TypeError` being raised when calling :meth:`~gridfs.GridFSBucket.download_to_stream`. This release also improves error messaging around BSON decoding.

Issues Resolved

See the PyMongo 3.2.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.2 (2015/12/07)

Version 3.2 implements the new server features introduced in MongoDB 3.2.

Highlights include:

Note

Certain :class:`~pymongo.mongo_client.MongoClient` properties now block until a connection is established or raise :exc:`~pymongo.errors.ServerSelectionTimeoutError` if no server is available. See :class:`~pymongo.mongo_client.MongoClient` for details.

Issues Resolved

See the PyMongo 3.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.1.1 (2015/11/17)

Version 3.1.1 fixes a few issues reported since the release of 3.1, including a regression in error handling for oversize command documents and interrupt handling issues in the C extensions.

Issues Resolved

See the PyMongo 3.1.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.1 (2015/11/02)

Version 3.1 implements a few new features and fixes bugs reported since the release of 3.0.3.

Highlights include:

Changes in internal classes

The private PeriodicExecutor class no longer takes a condition_class option, and the private thread_util.Event class is removed.

Issues Resolved

See the PyMongo 3.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.0.3 (2015/06/30)

Version 3.0.3 fixes issues reported since the release of 3.0.2, including a feature breaking bug in the GSSAPI implementation.

Issues Resolved

See the PyMongo 3.0.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.0.2 (2015/05/12)

Version 3.0.2 fixes issues reported since the release of 3.0.1, most importantly a bug that could route operations to replica set members that are not in primary or secondary state when using :class:`~pymongo.read_preferences.PrimaryPreferred` or :class:`~pymongo.read_preferences.Nearest`. It is a recommended upgrade for all users of PyMongo 3.0.x.

Issues Resolved

See the PyMongo 3.0.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.0.1 (2015/04/21)

Version 3.0.1 fixes issues reported since the release of 3.0, most importantly a bug in GridFS.delete that could prevent file chunks from actually being deleted.

Issues Resolved

See the PyMongo 3.0.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 3.0 (2015/04/07)

PyMongo 3.0 is a partial rewrite of PyMongo bringing a large number of improvements:

  • A unified client class. MongoClient is the one and only client class for connecting to a standalone mongod, replica set, or sharded cluster. Migrating from a standalone, to a replica set, to a sharded cluster can be accomplished with only a simple URI change.
  • MongoClient is much more responsive to configuration changes in your MongoDB deployment. All connected servers are monitored in a non-blocking manner. Slow to respond or down servers no longer block server discovery, reducing application startup time and time to respond to new or reconfigured servers and replica set failovers.
  • A unified CRUD API. All official MongoDB drivers now implement a standard CRUD API allowing polyglot developers to move from language to language with ease.
  • Single source support for Python 2.x and 3.x. PyMongo no longer relies on 2to3 to support Python 3.
  • A rewritten pure Python BSON implementation, improving performance with pypy and cpython deployments without support for C extensions.
  • Better support for greenlet based async frameworks including eventlet.
  • Immutable client, database, and collection classes, avoiding a host of thread safety issues in client applications.

PyMongo 3.0 brings a large number of API changes. Be sure to read the changes listed below before upgrading from PyMongo 2.x.

Warning

PyMongo no longer supports Python 2.4, 2.5, or 3.1. If you must use PyMongo with these versions of Python the 2.x branch of PyMongo will be minimally supported for some time.

SONManipulator changes

The :class:`~pymongo.son_manipulator.SONManipulator` API has limitations as a technique for transforming your data. Instead, it is more flexible and straightforward to transform outgoing documents in your own code before passing them to PyMongo, and transform incoming documents after receiving them from PyMongo.

Thus the :meth:`~pymongo.database.Database.add_son_manipulator` method is deprecated. PyMongo 3's new CRUD API does not apply SON manipulators to documents passed to :meth:`~pymongo.collection.Collection.bulk_write`, :meth:`~pymongo.collection.Collection.insert_one`, :meth:`~pymongo.collection.Collection.insert_many`, :meth:`~pymongo.collection.Collection.update_one`, or :meth:`~pymongo.collection.Collection.update_many`. SON manipulators are not applied to documents returned by the new methods :meth:`~pymongo.collection.Collection.find_one_and_delete`, :meth:`~pymongo.collection.Collection.find_one_and_replace`, and :meth:`~pymongo.collection.Collection.find_one_and_update`.

SSL/TLS changes

When ssl is True the ssl_cert_reqs option now defaults to :attr:`ssl.CERT_REQUIRED` if not provided. PyMongo will attempt to load OS provided CA certificates to verify the server, raising :exc:`~pymongo.errors.ConfigurationError` if it cannot.

Gevent Support

In previous versions, PyMongo supported Gevent in two modes: you could call gevent.monkey.patch_socket() and pass use_greenlets=True to :class:`~pymongo.mongo_client.MongoClient`, or you could simply call gevent.monkey.patch_all() and omit the use_greenlets argument.

In PyMongo 3.0, the use_greenlets option is gone. To use PyMongo with Gevent simply call gevent.monkey.patch_all().

For more information, see :doc:`PyMongo's Gevent documentation <examples/gevent>`.

:class:`~pymongo.mongo_client.MongoClient` is now the one and only client class for a standalone server, mongos, or replica set. It includes the functionality that had been split into MongoReplicaSetClient: it can connect to a replica set, discover all its members, and monitor the set for stepdowns, elections, and reconfigs. :class:`~pymongo.mongo_client.MongoClient` now also supports the full :class:`~pymongo.read_preferences.ReadPreference` API.

The obsolete classes MasterSlaveConnection, Connection, and ReplicaSetConnection are removed.

The :class:`~pymongo.mongo_client.MongoClient` constructor no longer blocks while connecting to the server or servers, and it no longer raises :class:`~pymongo.errors.ConnectionFailure` if they are unavailable, nor :class:`~pymongo.errors.ConfigurationError` if the user's credentials are wrong. Instead, the constructor returns immediately and launches the connection process on background threads. The connect option is added to control whether these threads are started immediately, or when the client is first used.

Therefore the alive method is removed since it no longer provides meaningful information; even if the client is disconnected, it may discover a server in time to fulfill the next operation.

In PyMongo 2.x, :class:`~pymongo.mongo_client.MongoClient` accepted a list of standalone MongoDB servers and used the first it could connect to:

MongoClient(['host1.com:27017', 'host2.com:27017'])

A list of multiple standalones is no longer supported; if multiple servers are listed they must be members of the same replica set, or mongoses in the same sharded cluster.

The behavior for a list of mongoses is changed from "high availability" to "load balancing". Before, the client connected to the lowest-latency mongos in the list, and used it until a network error prompted it to re-evaluate all mongoses' latencies and reconnect to one of them. In PyMongo 3, the client monitors its network latency to all the mongoses continuously, and distributes operations evenly among those with the lowest latency. See :ref:`mongos-load-balancing` for more information.

The client methods start_request, in_request, and end_request are removed, and so is the auto_start_request option. Requests were designed to make read-your-writes consistency more likely with the w=0 write concern. Additionally, a thread in a request used the same member for all secondary reads in a replica set. To ensure read-your-writes consistency in PyMongo 3.0, do not override the default write concern with w=0, and do not override the default :ref:`read preference <secondary-reads>` of PRIMARY.

Support for the slaveOk (or slave_okay), safe, and network_timeout options has been removed. Use :attr:`~pymongo.read_preferences.ReadPreference.SECONDARY_PREFERRED` instead of slave_okay. Accept the default write concern, acknowledged writes, instead of setting safe=True. Use socketTimeoutMS in place of network_timeout (note that network_timeout was in seconds, where as socketTimeoutMS is milliseconds).

The max_pool_size option has been removed. It is replaced by the maxPoolSize MongoDB URI option. maxPoolSize is now a supported URI option in PyMongo and can be passed as a keyword argument.

The copy_database method is removed, see the :doc:`copy_database examples </examples/copydb>` for alternatives.

The disconnect method is removed. Use :meth:`~pymongo.mongo_client.MongoClient.close` instead.

The get_document_class method is removed. Use :attr:`~pymongo.mongo_client.MongoClient.codec_options` instead.

The get_lasterror_options, set_lasterror_options, and unset_lasterror_options methods are removed. Write concern options can be passed to :class:`~pymongo.mongo_client.MongoClient` as keyword arguments or MongoDB URI options.

The :meth:`~pymongo.mongo_client.MongoClient.get_database` method is added for getting a Database instance with its options configured differently than the MongoClient's.

The following read-only attributes have been added:

The following attributes are now read-only:

The following attributes have been removed:

The following attributes have been renamed:

The conn_id property is renamed to :attr:`~pymongo.cursor.Cursor.address`.

Cursor management changes

:class:`~pymongo.cursor_manager.CursorManager` and :meth:`~pymongo.mongo_client.MongoClient.set_cursor_manager` are no longer deprecated. If you subclass :class:`~pymongo.cursor_manager.CursorManager` your implementation of :meth:`~pymongo.cursor_manager.CursorManager.close` must now take a second parameter, address. The BatchCursorManager class is removed.

The second parameter to :meth:`~pymongo.mongo_client.MongoClient.close_cursor` is renamed from _conn_id to address. :meth:`~pymongo.mongo_client.MongoClient.kill_cursors` now accepts an address parameter.

The connection property is renamed to :attr:`~pymongo.database.Database.client`.

The following read-only attributes have been added:

The following attributes are now read-only:

Use :meth:`~pymongo.mongo_client.MongoClient.get_database` for getting a Database instance with its options configured differently than the MongoClient's.

The following attributes have been removed:

The following methods have been added:

The following methods have been changed:

The following methods have been deprecated:

The following methods have been removed:

The get_lasterror_options, set_lasterror_options, and unset_lasterror_options methods have been removed. Use :class:`~pymongo.write_concern.WriteConcern` with :meth:`~pymongo.mongo_client.MongoClient.get_database` instead.

The following read-only attributes have been added:

The following attributes are now read-only:

Use :meth:`~pymongo.database.Database.get_collection` or :meth:`~pymongo.collection.Collection.with_options` for getting a Collection instance with its options configured differently than the Database's.

The following attributes have been removed:

The following methods have been added:

The following methods have changed:

The following methods are deprecated:

The following methods have been removed:

The get_lasterror_options, set_lasterror_options, and unset_lasterror_options methods have been removed. Use :class:`~pymongo.write_concern.WriteConcern` with :meth:`~pymongo.collection.Collection.with_options` instead.

The following find/find_one options have been renamed:

These renames only affect your code if you passed these as keyword arguments, like find(fields=['fieldname']). If you passed only positional parameters these changes are not significant for your application.

  • spec -> filter
  • fields -> projection
  • partial -> allow_partial_results

The following find/find_one options have been added:

The following find/find_one options have been removed:

The following find/find_one options are deprecated:

  • manipulate

The following renames need special handling.

  • timeout -> no_cursor_timeout - The default for timeout was True. The default for no_cursor_timeout is False. If you were previously passing False for t`imeout you must pass True for no_cursor_timeout to keep the previous behavior.

The exception classes UnsupportedOption and TimeoutError are deleted.

Since PyMongo 1.6, methods open and close of :class:`~gridfs.GridFS` raised an UnsupportedAPI exception, as did the entire GridFile class. The unsupported methods, the class, and the exception are all deleted.

:mod:`~bson` changes

The compile_re option is removed from all methods that accepted it in :mod:`~bson` and :mod:`~bson.json_util`. Additionally, it is removed from :meth:`~pymongo.collection.Collection.find`, :meth:`~pymongo.collection.Collection.find_one`, :meth:`~pymongo.collection.Collection.aggregate`, :meth:`~pymongo.database.Database.command`, and so on. PyMongo now always represents BSON regular expressions as :class:`~bson.regex.Regex` objects. This prevents errors for incompatible patterns, see PYTHON-500. Use :meth:`~bson.regex.Regex.try_compile` to attempt to convert from a BSON regular expression to a Python regular expression object.

PyMongo now decodes the int64 BSON type to :class:`~bson.int64.Int64`, a trivial wrapper around long (in python 2.x) or int (in python 3.x). This allows BSON int64 to be round tripped without losing type information in python 3. Note that if you store a python long (or a python int larger than 4 bytes) it will be returned from PyMongo as :class:`~bson.int64.Int64`.

The as_class, tz_aware, and uuid_subtype options are removed from all BSON encoding and decoding methods. Use :class:`~bson.codec_options.CodecOptions` to configure these options. The APIs affected are:

This is a breaking change for any application that uses the BSON API directly and changes any of the named parameter defaults. No changes are required for applications that use the default values for these options. The behavior remains the same.

Issues Resolved

See the PyMongo 3.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9.5 (2017/06/30)

Version 2.9.5 works around ssl module deprecations in Python 3.6, and expected future ssl module deprecations. It also fixes bugs found since the release of 2.9.4.

Issues Resolved

See the PyMongo 2.9.5 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9.4 (2016/09/30)

Version 2.9.4 fixes issues reported since the release of 2.9.3.

Issues Resolved

See the PyMongo 2.9.4 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9.3 (2016/03/15)

Version 2.9.3 fixes a few issues reported since the release of 2.9.2 including thread safety issues in :meth:`~pymongo.collection.Collection.ensure_index`, :meth:`~pymongo.collection.Collection.drop_index`, and :meth:`~pymongo.collection.Collection.drop_indexes`.

Issues Resolved

See the PyMongo 2.9.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9.2 (2016/02/16)

Version 2.9.2 restores Python 3.1 support, which was broken in PyMongo 2.8. It improves an error message when decoding BSON as well as fixes a couple other issues including :meth:`~pymongo.collection.Collection.aggregate` ignoring :attr:`~pymongo.collection.Collection.codec_options` and :meth:`~pymongo.database.Database.command` raising a superfluous DeprecationWarning.

Issues Resolved

See the PyMongo 2.9.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9.1 (2015/11/17)

Version 2.9.1 fixes two interrupt handling issues in the C extensions and adapts a test case for a behavior change in MongoDB 3.2.

Issues Resolved

See the PyMongo 2.9.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.9 (2015/09/30)

Version 2.9 provides an upgrade path to PyMongo 3.x. Most of the API changes from PyMongo 3.0 have been backported in a backward compatible way, allowing applications to be written against PyMongo >= 2.9, rather then PyMongo 2.x or PyMongo 3.x. See the PyMongo 3 Migration Guide for detailed examples.

Note

There are a number of new deprecations in this release for features that were removed in PyMongo 3.0.

:class:`~pymongo.mongo_client.MongoClient`:
:class:`~pymongo.mongo_replica_set_client.MongoReplicaSetClient`:
:class:`~pymongo.database.Database`:
:class:`~pymongo.collection.Collection`:

Warning

In previous versions of PyMongo, changing the value of :attr:`~pymongo.mongo_client.MongoClient.document_class` changed the behavior of all existing instances of :class:`~pymongo.collection.Collection`:

>>> coll = client.test.test
>>> coll.find_one()
{u'_id': ObjectId('5579dc7cfba5220cc14d9a18')}
>>> from bson.son import SON
>>> client.document_class = SON
>>> coll.find_one()
SON([(u'_id', ObjectId('5579dc7cfba5220cc14d9a18'))])

The document_class setting is now configurable at the client, database, collection, and per-operation level. This required breaking the existing behavior. To change the document class per operation in a forward compatible way use :meth:`~pymongo.collection.Collection.with_options`:

>>> coll.find_one()
{u'_id': ObjectId('5579dc7cfba5220cc14d9a18')}
>>> from bson.codec_options import CodecOptions
>>> coll.with_options(CodecOptions(SON)).find_one()
SON([(u'_id', ObjectId('5579dc7cfba5220cc14d9a18'))])

Issues Resolved

See the PyMongo 2.9 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.8.1 (2015/05/11)

Version 2.8.1 fixes a number of issues reported since the release of PyMongo 2.8. It is a recommended upgrade for all users of PyMongo 2.x.

Issues Resolved

See the PyMongo 2.8.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.8 (2015/01/28)

Version 2.8 is a major release that provides full support for MongoDB 3.0 and fixes a number of bugs.

Special thanks to Don Mitchell, Ximing, Can Zhang, Sergey Azovskov, and Heewa Barfchin for their contributions to this release.

Highlights include:

Note

There are a number of deprecations in this release for features that will be removed in PyMongo 3.0. These include:

The JSON format for :class:`~bson.timestamp.Timestamp` has changed from '{"t": <int>, "i": <int>}' to '{"$timestamp": {"t": <int>, "i": <int>}}'. This new format will be decoded to an instance of :class:`~bson.timestamp.Timestamp`. The old format will continue to be decoded to a python dict as before. Encoding to the old format is no longer supported as it was never correct and loses type information.

Issues Resolved

See the PyMongo 2.8 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.7.2 (2014/07/29)

Version 2.7.2 includes fixes for upsert reporting in the bulk API for MongoDB versions previous to 2.6, a regression in how son manipulators are applied in :meth:`~pymongo.collection.Collection.insert`, a few obscure connection pool semaphore leaks, and a few other minor issues. See the list of issues resolved for full details.

Issues Resolved

See the PyMongo 2.7.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.7.1 (2014/05/23)

Version 2.7.1 fixes a number of issues reported since the release of 2.7, most importantly a fix for creating indexes and manipulating users through mongos versions older than 2.4.0.

Issues Resolved

See the PyMongo 2.7.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.7 (2014/04/03)

PyMongo 2.7 is a major release with a large number of new features and bug fixes. Highlights include:

Breaking changes

Version 2.7 drops support for replica sets running MongoDB versions older than 1.6.2.

Issues Resolved

See the PyMongo 2.7 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.6.3 (2013/10/11)

Version 2.6.3 fixes issues reported since the release of 2.6.2, most importantly a semaphore leak when a connection to the server fails.

Issues Resolved

See the PyMongo 2.6.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.6.2 (2013/09/06)

Version 2.6.2 fixes a :exc:`TypeError` problem when max_pool_size=None is used in Python 3.

Issues Resolved

See the PyMongo 2.6.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.6.1 (2013/09/03)

Version 2.6.1 fixes a reference leak in the :meth:`~pymongo.collection.Collection.insert` method.

Issues Resolved

See the PyMongo 2.6.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.6 (2013/08/19)

Version 2.6 includes some frequently requested improvements and adds support for some early MongoDB 2.6 features.

Special thanks go to Justin Patrin for his work on the connection pool in this release.

Important new features:

Warning

SIGNIFICANT BEHAVIOR CHANGE in 2.6. Previously, max_pool_size would limit only the idle sockets the pool would hold onto, not the number of open sockets. The default has also changed, from 10 to 100. If you pass a value for max_pool_size make sure it is large enough for the expected load. (Sockets are only opened when needed, so there is no cost to having a max_pool_size larger than necessary. Err towards a larger value.) If your application accepts the default, continue to do so.

See :ref:`connection-pooling` for more information.

Issues Resolved

See the PyMongo 2.6 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.5.2 (2013/06/01)

Version 2.5.2 fixes a NULL pointer dereference issue when decoding an invalid :class:`~bson.dbref.DBRef`.

Issues Resolved

See the PyMongo 2.5.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.5.1 (2013/05/13)

Version 2.5.1 is a minor release that fixes issues discovered after the release of 2.5. Most importantly, this release addresses some race conditions in replica set monitoring.

Issues Resolved

See the PyMongo 2.5.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.5 (2013/03/22)

Version 2.5 includes changes to support new features in MongoDB 2.4.

Important new features:

Note

:meth:`~pymongo.database.Database.authenticate` now raises a subclass of :class:`~pymongo.errors.PyMongoError` if authentication fails due to invalid credentials or configuration issues.

Issues Resolved

See the PyMongo 2.5 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.4.2 (2013/01/23)

Version 2.4.2 is a minor release that fixes issues discovered after the release of 2.4.1. Most importantly, PyMongo will no longer select a replica set member for read operations that is not in primary or secondary state.

Issues Resolved

See the PyMongo 2.4.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.4.1 (2012/12/06)

Version 2.4.1 is a minor release that fixes issues discovered after the release of 2.4. Most importantly, this release fixes a regression using :meth:`~pymongo.collection.Collection.aggregate`, and possibly other commands, with mongos.

Issues Resolved

See the PyMongo 2.4.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.4 (2012/11/27)

Version 2.4 includes a few important new features and a large number of bug fixes.

Important new features:

Issues Resolved

See the PyMongo 2.4 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.3 (2012/08/29)

Version 2.3 adds support for new features and behavior changes in MongoDB 2.2.

Important New Features:

Warning

Starting with MongoDB 2.2 the getLastError command requires authentication when the server's authentication features are enabled. Changes to PyMongo were required to support this behavior change. Users of authentication must upgrade to PyMongo 2.3 (or newer) for "safe" write operations to function correctly.

Issues Resolved

See the PyMongo 2.3 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.2.1 (2012/07/06)

Version 2.2.1 is a minor release that fixes issues discovered after the release of 2.2. Most importantly, this release fixes an incompatibility with mod_wsgi 2.x that could cause connections to leak. Users of mod_wsgi 2.x are strongly encouraged to upgrade from PyMongo 2.2.

Issues Resolved

See the PyMongo 2.2.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.2 (2012/04/30)

Version 2.2 adds a few more frequently requested features and fixes a number of bugs.

Special thanks go to Alex Grönholm for his contributions to Python 3 support and maintaining the original pymongo3 port. Christoph Simon, Wouter Bolsterlee, Mike O'Brien, and Chris Tompkinson also contributed to this release.

Important New Features:

Warning

A number of methods and method parameters that were deprecated in PyMongo 1.9 or older versions have been removed in this release. The full list of changes can be found in the following JIRA ticket:

https://jira.mongodb.org/browse/PYTHON-305

BSON module aliases from the pymongo package that were deprecated in PyMongo 1.9 have also been removed in this release. See the following JIRA ticket for details:

https://jira.mongodb.org/browse/PYTHON-304

As a result of this cleanup some minor code changes may be required to use this release.

Issues Resolved

See the PyMongo 2.2 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.1.1 (2012/01/04)

Version 2.1.1 is a minor release that fixes a few issues discovered after the release of 2.1. You can now use :class:`~pymongo.replica_set_connection.ReplicaSetConnection` to run inline map reduce commands on secondaries. See :meth:`~pymongo.collection.Collection.inline_map_reduce` for details.

Special thanks go to Samuel Clay and Ross Lawley for their contributions to this release.

Issues Resolved

See the PyMongo 2.1.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.1 (2011/12/07)

Version 2.1 adds a few frequently requested features and includes the usual round of bug fixes and improvements.

Special thanks go to Alexey Borzenkov, Dan Crosta, Kostya Rybnikov, Flavio Percoco Premoli, Jonas Haag, and Jesse Davis for their contributions to this release.

Important New Features:

Issues Resolved

See the PyMongo 2.1 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 2.0.1 (2011/08/15)

Version 2.0.1 fixes a regression in :class:`~gridfs.grid_file.GridIn` when writing pre-chunked strings. Thanks go to Alexey Borzenkov for reporting the issue and submitting a patch.

Issues Resolved

  • PYTHON-271: Regression in GridFS leads to serious loss of data.

Changes in Version 2.0 (2011/08/05)

Version 2.0 adds a large number of features and fixes a number of issues.

Special thanks go to James Murty, Abhay Vardhan, David Pisoni, Ryan Smith-Roberts, Andrew Pendleton, Mher Movsisyan, Reed O'Brien, Michael Schurter, Josip Delic and Jonas Haag for their contributions to this release.

Important New Features:

  • PyMongo now performs automatic per-socket database authentication. You no longer have to re-authenticate for each new thread or after a replica set failover. Authentication credentials are cached by the driver until the application calls :meth:`~pymongo.database.Database.logout`.
  • slave_okay can be set independently at the connection, database, collection or query level. Each level will inherit the slave_okay setting from the previous level and each level can override the previous level's setting.
  • safe and getLastError options (e.g. w, wtimeout, etc.) can be set independently at the connection, database, collection or query level. Each level will inherit settings from the previous level and each level can override the previous level's setting.
  • PyMongo now supports the await_data and partial cursor flags. If the await_data flag is set on a tailable cursor the server will block for some extra time waiting for more data to return. The partial flag tells a mongos to return partial data for a query if not all shards are available.
  • :meth:`~pymongo.collection.Collection.map_reduce` will accept a dict or instance of :class:`~bson.son.SON` as the out parameter.
  • The URI parser has been moved into its own module and can be used directly by application code.
  • AutoReconnect exception now provides information about the error that actually occurred instead of a generic failure message.
  • A number of new helper methods have been added with options for setting and unsetting cursor flags, re-indexing a collection, fsync and locking a server, and getting the server's current operations.

API changes:

  • If only one host:port pair is specified :class:`~pymongo.connection.Connection` will make a direct connection to only that host. Please note that slave_okay must be True in order to query from a secondary.
  • If more than one host:port pair is specified or the replicaset option is used PyMongo will treat the specified host:port pair(s) as a seed list and connect using replica set behavior.

Issues Resolved

See the PyMongo 2.0 release notes in JIRA for the list of resolved issues in this release.

Changes in Version 1.11 (2011/05/05)

Version 1.11 adds a few new features and fixes a few more bugs.

New Features:

API changes:

  • :meth:`~pymongo.database.Database.validate_collection` now returns a dict instead of a string. This change was required to deal with an API change on the server. This method also now takes the optional scandata and full parameters. See the documentation for more details.

Warning

The pool_size, auto_start_request`, and timeout parameters for :class:`~pymongo.connection.Connection` have been completely removed in this release. They were deprecated in pymongo-1.4 and have had no effect since then. Please make sure that your code doesn't currently pass these parameters when creating a Connection instance.

Issues resolved

  • PYTHON-241: Support setting slaveok at the cursor level.
  • PYTHON-240: Queries can sometimes permanently fail after a replica set fail over.
  • PYTHON-238: error after few million requests
  • PYTHON-237: Basic IPv6 support.
  • PYTHON-236: Restore option to specify pool size in Connection.
  • PYTHON-212: pymongo does not recover after stale config
  • PYTHON-138: Find method for GridFS

Changes in Version 1.10.1 (2011/04/07)

Version 1.10.1 is primarily a bugfix release. It fixes a regression in version 1.10 that broke pickling of ObjectIds. A number of other bugs have been fixed as well.

There are two behavior changes to be aware of:

Issues resolved

  • PYTHON-234: Fix setup.py to raise exception if any when building extensions
  • PYTHON-233: Add information to build and test with extensions on windows
  • PYTHON-232: Traceback when hashing a DBRef instance
  • PYTHON-231: Traceback when pickling a DBRef instance
  • PYTHON-230: Pickled ObjectIds are not compatible between pymongo 1.9 and 1.10
  • PYTHON-228: Cannot pickle bson.ObjectId
  • PYTHON-227: Traceback when calling find() on system.js
  • PYTHON-216: MasterSlaveConnection is missing disconnect() method
  • PYTHON-186: When storing integers, type is selected according to value instead of type
  • PYTHON-173: as_class option is not propagated by Cursor.clone
  • PYTHON-113: Redunducy in MasterSlaveConnection

Changes in Version 1.10 (2011/03/30)

Version 1.10 includes changes to support new features in MongoDB 1.8.x. Highlights include a modified map/reduce API including an inline map/reduce helper method, a new find_and_modify helper, and the ability to query the server for the maximum BSON document size it supports.

Warning

MongoDB versions greater than 1.7.4 no longer generate temporary collections for map/reduce results. An output collection name must be provided and the output will replace any existing output collection with the same name. :meth:`~pymongo.collection.Collection.map_reduce` now requires the out parameter.

Issues resolved

  • PYTHON-225: :class:`~pymongo.objectid.ObjectId` class definition should use __slots__.
  • PYTHON-223: Documentation fix.
  • PYTHON-220: Documentation fix.
  • PYTHON-219: KeyError in :meth:`~pymongo.collection.Collection.find_and_modify`
  • PYTHON-213: Query server for maximum BSON document size.
  • PYTHON-208: Fix :class:`~pymongo.connection.Connection` __repr__.
  • PYTHON-207: Changes to Map/Reduce API.
  • PYTHON-205: Accept slaveOk in the URI to match the URI docs.
  • PYTHON-203: When slave_okay=True and we only specify one host don't autodetect other set members.
  • PYTHON-194: Show size when whining about a document being too large.
  • PYTHON-184: Raise :class:`~pymongo.errors.DuplicateKeyError` for duplicate keys in capped collections.
  • PYTHON-178: Don't segfault when trying to encode a recursive data structure.
  • PYTHON-177: Don't segfault when decoding dicts with broken iterators.
  • PYTHON-172: Fix a typo.
  • PYTHON-170: Add :meth:`~pymongo.collection.Collection.find_and_modify`.
  • PYTHON-169: Support deepcopy of DBRef.
  • PYTHON-167: Duplicate of PYTHON-166.
  • PYTHON-166: Fixes a concurrency issue.
  • PYTHON-158: Add code and err string to db assertion messages.

Changes in Version 1.9 (2010/09/28)

Version 1.9 adds a new package to the PyMongo distribution, :mod:`bson`. :mod:`bson` contains all of the BSON encoding and decoding logic, and the BSON types that were formerly in the :mod:`pymongo` package. The following modules have been renamed:

In addition, the following exception classes have been renamed:

The above exceptions now inherit from :class:`bson.errors.BSONError` rather than :class:`pymongo.errors.PyMongoError`.

Note

All of the renamed modules and exceptions above have aliases created with the old names, so these changes should not break existing code. The old names will eventually be deprecated and then removed, so users should begin migrating towards the new names now.

Warning

The change to the exception hierarchy mentioned above is possibly breaking. If your code is catching :class:`~pymongo.errors.PyMongoError`, then the exceptions raised by :mod:`bson` will not be caught, even though they would have been caught previously. Before upgrading, it is recommended that users check for any cases like this.

Changes in Version 1.8.1 (2010/08/13)

Changes in Version 1.8 (2010/08/05)

Version 1.8 adds support for connecting to replica sets, specifying per-operation values for w and wtimeout, and decoding to timezone-aware datetimes.

Changes in Version 1.7 (2010/06/17)

Version 1.7 is a recommended upgrade for all PyMongo users. The full release notes are below, and some more in depth discussion of the highlights is here.

Changes in Version 1.6 (2010/04/14)

The biggest change in version 1.6 is a complete re-implementation of :mod:`gridfs` with a lot of improvements over the old implementation. There are many details and examples of using the new API in this blog post. The old API has been removed in this version, so existing code will need to be modified before upgrading to 1.6.

Changes in Version 1.5.2 (2010/03/31)

  • fixed response handling to ignore unknown response flags in queries.
  • handle server versions containing '-pre-'.

Changes in Version 1.5.1 (2010/03/17)

Changes in Version 1.5 (2010/03/10)

Changes in Version 1.4 (2010/01/17)

Perhaps the most important change in version 1.4 is that we have decided to no longer support Python 2.3. The most immediate reason for this is to allow some improvements to connection pooling. This will also allow us to use some new (as in Python 2.4 ;) idioms and will help begin the path towards supporting Python 3.0. If you need to use Python 2.3 you should consider using version 1.3 of this driver, although that will no longer be actively supported.

Other changes:

Changes in Version 1.3 (2009/12/16)

Changes in Version 1.2.1 (2009/12/10)

Changes in Version 1.2 (2009/12/09)

Changes in Version 1.1.2 (2009/11/23)

Changes in Version 1.1.1 (2009/11/14)

Changes in Version 1.1 (2009/10/21)

Changes in Version 1.0 (2009/09/30)

Changes in Version 0.16 (2009/09/16)

Changes in Version 0.15.2 (2009/09/09)

  • documentation changes only

Changes in Version 0.15.1 (2009/09/02)

Changes in Version 0.15 (2009/08/26)

Changes in Version 0.14.2 (2009/08/24)

  • minor bugfixes

Changes in Version 0.14.1 (2009/08/21)

Changes in Version 0.14 (2009/08/19)

Changes in Version 0.13 (2009/07/29)

Changes in Version 0.12 (2009/07/08)

Changes in Version 0.11.3 (2009/06/18)

  • don't allow NULL bytes in string encoder
  • fixes for Python 2.3

Changes in Version 0.11.2 (2009/06/08)

Changes in Version 0.11.1 (2009/06/04)

  • fix for connection pooling under Python 2.5

Changes in Version 0.11 (2009/06/03)

  • better build failure detection
  • driver support for selecting fields in sub-documents
  • disallow insertion of invalid key names
  • added timeout parameter for :meth:`~pymongo.connection.Connection`

Changes in Version 0.10.3 (2009/05/27)

Changes in Version 0.10.2 (2009/05/22)

Changes in Version 0.10.1 (2009/05/18)

Changes in Version 0.10 (2009/05/14)

Changes in Version 0.9.7 (2009/05/13)