PyMongo Changelog

What's new in PyMongo 3.5.0

Aug 9, 2017
  • Highlights include:
  • Username and password can be passed to MongoClient as keyword arguments. Before, the only way to pass them was in the URI.
  • Increased the performance of using RawBSONDocument.
  • Increased the performance of database_names() by using the nameOnly option for listDatabases when available.
  • Increased the performance of bulk_write() by reducing the memory overhead of InsertOne, DeleteOne, and DeleteMany.
  • Added the collation option to DeleteOne, DeleteMany, ReplaceOne, UpdateOne, and UpdateMany.
  • Implemented the MongoDB Extended JSON specification.
  • Decimal128 now works when cdecimal is installed.
  • PyMongo is now tested against a wider array of operating systems and CPU architectures (including s390x, ARM64, and POWER8).
  • Changes and Deprecations:
  • find() has new options return_key, show_record_id, snapshot, hint, max_time_ms, max_scan, min, max, and comment. Deprecated the option modifiers.
  • Deprecated group(). The group command was deprecated in MongoDB 3.4 and is expected to be removed in MongoDB 3.6. Applications should use aggregate() with the $group pipeline stage instead.
  • Deprecated authenticate(). Authenticating multiple users conflicts with support for logical sessions in MongoDB 3.6. To authenticate as multiple users, create multiple instances of MongoClient.
  • Deprecated eval(). The eval command was deprecated in MongoDB 3.0 and will be removed in a future server version.
  • Deprecated SystemJS.
  • Deprecated get_default_database(). Applications should use get_database() without the name parameter instead.
  • Deprecated the MongoClient option socketKeepAlive. It now defaults to true and disabling it is not recommended, see does TCP keepalive time affect MongoDB Deployments?
  • Deprecated initialize_ordered_bulk_op(), initialize_unordered_bulk_op(), and BulkOperationBuilder. Use bulk_write() instead.
  • Deprecated STRICT_JSON_OPTIONS. Use RELAXED_JSON_OPTIONS or CANONICAL_JSON_OPTIONS instead.
  • If a custom CodecOptions is passed to RawBSONDocument, its document_class must be RawBSONDocument.
  • list_indexes() no longer raises OperationFailure when the collection (or database) does not exist on MongoDB >= 3.0. Instead, it returns an empty CommandCursor to make the behavior consistent across all MongoDB versions.
  • In Python 3, loads() now automatically decodes JSON $binary with a subtype of 0 into bytes instead of Binary. See the Python 3 FAQ for more details.
  • loads() now raises TypeError or ValueError when parsing JSON type wrappers with values of the wrong type or any extra keys.
  • pymongo.cursor.Cursor.close() and pymongo.mongo_client.MongoClient.close() now kill cursors synchronously instead of deferring to a background thread.
  • parse_uri() now returns the original value of the readPreference MongoDB URI option instead of the validated read preference mode.

New in PyMongo 3.0.2 (May 18, 2015)

  • 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 PrimaryPreferred or Nearest. It is a recommended upgrade for all users of PyMongo 3.0.x.

New in PyMongo 3.0.1 (Apr 22, 2015)

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

New in PyMongo 3.0 (Apr 8, 2015)

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

New in PyMongo 3.0 RC 0 (Mar 26, 2015)

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

New in PyMongo 2.8 (Feb 14, 2015)

  • Support for the SCRAM-SHA-1 authentication mechanism (new in MongoDB 3.0).
  • JSON decoder support for the new $numberLong and $undefined types.
  • JSON decoder support for the $date type as an ISO-8601 string.
  • Support passing an index name to hint().
  • The count() method will use a hint if one has been provided through hint().
  • A new socketKeepAlive option for the connection pool.
  • New generator based BSON decode functions, decode_iter() and decode_file_iter().
  • Internal changes to support alternative storage engines like wiredtiger.

New in PyMongo 2.7.2 (Jul 30, 2014)

  • 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 insert(), a few obscure connection pool semaphore leaks, and a few other minor issues. See the list of issues resolved for full details.

New in PyMongo 2.7.1 (May 24, 2014)

  • 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.
  • Fixed issues:
  • Bug PYTHON-667: drop_index fails with OperationFailure if no index found on collection
  • Bug PYTHON-684: jnote and wnote should not raise errors when connected to legacy servers
  • Bug PYTHON-696: Index and user manipulation broken with mongos versions before 2.4.0

New in PyMongo 2.7 (Apr 4, 2014)

  • Full support for MongoDB 2.6.
  • A new bulk write operations API.
  • Support for server side query timeouts using max_time_ms().
  • Support for writing aggregate() output to a collection.
  • A new parallel_scan() helper.
  • OperationFailure and its subclasses now include a details attribute with complete error details from the server.
  • A new GridFS find() method that returns a GridOutCursor.
  • Greatly improved support for mod_wsgi when using PyMongo’s C extensions. Read Jesse’s blog post for details.
  • Improved C extension support for ARM little endian.

New in PyMongo 2.0 (Aug 6, 2011)

  • 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 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.
  • map_reduce() will accept a dict or instance of 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 occured 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 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.

New in PyMongo 1.7 (Jun 18, 2010)

  • no longer attempt to build the C extension on big-endian systems.
  • added MinKey and MaxKey.
  • use unsigned for Timestamp in BSON encoder/decoder.
  • support True as "ok" in command responses, in addition to 1.0 - necessary for server versions >= 1.5.X
  • BREAKING change to index_information() to add support for querying unique status and other index information.
  • added document_class, to specify class for returned documents.
  • added as_class argument for find(), and in the BSON decoder.
  • added support for creating Timestamp instances using a datetime.
  • allow dropTarget argument for rename.
  • handle aware datetime instances, by converting to UTC.
  • added support for max_scan.
  • raise FileExists exception when creating a duplicate GridFS file.
  • use y2038 for time handling in the C extension - eliminates 2038 problems when extension is installed.
  • added sort parameter to find()
  • finalized deprecation of changes from versions

New in PyMongo 1.5.1 (Mar 18, 2010)

  • added _id property for GridFile instances.
  • fix for making a Connection (with slave_okay set) directly to a slave in a replica pair.
  • accept kwargs for create_index() and ensure_index() to support all indexing options.
  • add pymongo.GEO2D and support for geo indexing.
  • improvements to Python code caching in C extension - should improve behavior on mod_wsgi.

New in PyMongo 1.5 (Mar 11, 2010)

  • added subtype constants to :mod:`~pymongo.binary` module.
  • System Message: ERROR/3 (, line 6); backlink
  • Unknown interpreted text role "mod".
  • DEPRECATED options argument to :meth:`~pymongo.collection.Collection` and :meth:`~pymongo.database.Database.create_collection` in favor of kwargs.
  • System Message: ERROR/3 (, line 7); backlink
  • Unknown interpreted text role "meth".
  • System Message: ERROR/3 (, line 7); backlink
  • Unknown interpreted text role "meth".
  • added :meth:`~pymongo.has_c` to check for C extension.
  • System Message: ERROR/3 (, line 11); backlink
  • Unknown interpreted text role "meth".
  • added :meth:`~pymongo.connection.Connection.copy_database`.
  • System Message: ERROR/3 (, line 12); backlink
  • Unknown interpreted text role "meth".
  • Added :data:`~pymongo.cursor.Cursor.alive` to tell when a cursor might have more data to return (useful for tailable cursors).
  • System Message: ERROR/3 (, line 13); backlink
  • Unknown interpreted text role "data".
  • added :class:`~pymongo.timestamp.Timestamp` to better support dealing with internal MongoDB timestamps.
  • System Message: ERROR/3 (, line 15); backlink
  • Unknown interpreted text role "class".
  • added name argument for :meth:`~pymongo.collection.Collection.create_index` and :meth:`~pymongo.collection.Collection.ensure_index`.
  • meth:`~pymongo.connection.Connection.paired` takes all kwargs that are allowed for :meth:`~pymongo.connection.Connection`.
  • System Message: ERROR/3 (, line 21); backlink
  • Unknown interpreted text role "meth".
  • System Message: ERROR/3 (, line 21); backlink
  • Unknown interpreted text role "meth".
  • meth:`~pymongo.collection.Collection.insert` returns list for bulk inserts of size one.
  • System Message: ERROR/3 (, line 23); backlink
  • Unknown interpreted text role "meth".
  • Fixed handling of :class:`datetime.datetime` instances in :mod:`~pymongo.json_util`.
  • System Message: ERROR/3 (, line 25); backlink
  • Unknown interpreted text role "class".
  • tem Message: ERROR/3 (, line 25); backlink
  • :meth:`~pymongo.database.Database.command` takes a string for simple commands.
  • System Message: ERROR/3 (, line 30); backlink
  • Unknown interpreted text role "meth".
  • added :data:`~pymongo.database.Database.system_js` helper for dealing with server-side JS.
  • System Message: ERROR/3 (, line 32); backlink
  • Unknown interpreted text role "data".
  • don't wrap queries containing "$query" (support manual use of "$min", etc.).
  • added :class:`~gridfs.errors.GridFSError` as base class for :mod:`gridfs` exceptions.
  • System Message: ERROR/3 (, line 36); backlink
  • Unknown interpreted text role "class".
  • System Message: ERROR/3 (, line 36); backlink
  • Unknown interpreted text role "mod".

New in PyMongo 1.4 (Feb 12, 2010)

  • 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:
  • move ``"_id"`` to front only for top-level documents (fixes some corner cases).
  • :meth:`~pymongo.collection.Collection.update` and :meth:`~pymongo.collection.Collection.remove` return the entire response to the *lastError* command when safe is ``True``.
  • completed removal of things that were deprecated in version 1.2 or earlier.
  • enforce that collection names do not contain the NULL byte.
  • fix to allow using UTF-8 collection names with the C extension.
  • added :class:`~pymongo.errors.PyMongoError` as base exception class for all :mod:`~pymongo.errors`. this changes the exception hierarchy somewhat, and is a BREAKING change if you depend on :class:`~pymongo.errors.ConnectionFailure` being a :class:`IOError` or :class:`~pymongo.errors.InvalidBSON` being a :class:`ValueError`, for example.
  • added :class:`~pymongo.errors.DuplicateKeyError` for calls to :meth:`~pymongo.collection.Collection.insert` or :meth:`~pymongo.collection.Collection.update` with `safe` set to ``True``.
  • removed :mod:`~pymongo.thread_util`
  • added :meth:`~pymongo.database.Database.add_user` and :meth:`~pymongo.database.Database.remove_user` helpers.
  • fix for :meth:`~pymongo.database.Database.authenticate` when using non-UTF-8 names or passwords.
  • minor fixes for :class:`~pymongo.master_slave_connection.MasterSlaveConnection`.
  • clean up all cases where :class:`~pymongo.errors.ConnectionFailure` is raised.
  • simplification of connection pooling makes driver ~2x faster for simple benchmarks. see :ref:`connection-pooling` for more information.
  • DEPRECATED `pool_size`, `auto_start_request` and `timeout` parameters to :class:`~pymongo.connection.Connection`. DEPRECATED :meth:`~pymongo.connection.Connection.start_request`.
  • use :meth:`socket.sendall`.
  • removed :meth:`~pymongo.son.SON.from_xml` as it was only being used for some internal testing also eliminates dependency on :mod:`elementtree`.
  • implementation of :meth:`~pymongo.message.update` in C.
  • deprecate :meth:`~pymongo.database.Database._command` in favor of :meth:`~pymongo.database.Database.command`.
  • send all commands without wrapping as ``{"query": ...}``.
  • support string as `key` argument to :meth:`~pymongo.collection.Collection.group` (keyf) and run all groups as commands.
  • support for equality testing for :class:`~pymongo.code.Code` instances.
  • allow the NULL byte in strings and disallow it in key names or regex patterns

New in PyMongo 0.15.2 (Sep 10, 2009)

  • Only doc changes.

New in PyMongo 0.15 (Aug 27, 2009)

  • encode tuple as list

New in PyMongo 0.14.2 (Aug 25, 2009)

  • clean out pyd build artifacts as well MINOR