|
|
|
|
@ -572,7 +572,7 @@ Breaking Changes in 4.0
|
|
|
|
|
- Comparing two :class:`~pymongo.mongo_client.MongoClient` instances now
|
|
|
|
|
uses a set of immutable properties rather than
|
|
|
|
|
:attr:`~pymongo.mongo_client.MongoClient.address` which can change.
|
|
|
|
|
- Removed the `disable_md5` parameter for :class:`~gridfs.GridFSBucket` and
|
|
|
|
|
- Removed the ``disable_md5`` parameter for :class:`~gridfs.GridFSBucket` and
|
|
|
|
|
:class:`~gridfs.GridFS`. See :ref:`removed-gridfs-checksum` for details.
|
|
|
|
|
- pymongocrypt 1.2.0 or later is now required for client side field level
|
|
|
|
|
encryption support.
|
|
|
|
|
@ -585,10 +585,10 @@ Notable improvements
|
|
|
|
|
- Added the ``maxConnecting`` URI and
|
|
|
|
|
:class:`~pymongo.mongo_client.MongoClient` keyword argument.
|
|
|
|
|
- :class:`~pymongo.mongo_client.MongoClient` now accepts a URI and keyword
|
|
|
|
|
argument `srvMaxHosts` that limits the number of mongos-like hosts a client
|
|
|
|
|
argument ``srvMaxHosts`` that limits the number of mongos-like hosts a client
|
|
|
|
|
will connect to. More specifically, when a mongodb+srv:// connection string
|
|
|
|
|
resolves to more than `srvMaxHosts` number of hosts, the client will randomly
|
|
|
|
|
choose a `srvMaxHosts` sized subset of hosts.
|
|
|
|
|
resolves to more than ``srvMaxHosts`` number of hosts, the client will randomly
|
|
|
|
|
choose a ``srvMaxHosts`` sized subset of hosts.
|
|
|
|
|
- Added :attr:`pymongo.mongo_client.MongoClient.options` for read-only access
|
|
|
|
|
to a client's configuration options.
|
|
|
|
|
- Support for the "kmip" KMS provider for client side field level encryption.
|
|
|
|
|
@ -747,7 +747,7 @@ Changes in Version 3.12.0
|
|
|
|
|
- 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.
|
|
|
|
|
Call ``seek(0)`` to reset the iterator.
|
|
|
|
|
|
|
|
|
|
Notable improvements
|
|
|
|
|
....................
|
|
|
|
|
@ -1200,9 +1200,9 @@ Changes in Version 3.8.0
|
|
|
|
|
is expected to require a :meth:`~pymongo.cursor.Cursor.hint` when using
|
|
|
|
|
min/max starting in MongoDB 4.2.
|
|
|
|
|
- Documented support for the uuidRepresentation URI option, which has been
|
|
|
|
|
supported since PyMongo 2.7. Valid values are `pythonLegacy` (the default),
|
|
|
|
|
`javaLegacy`, `csharpLegacy` and `standard`. New applications should consider
|
|
|
|
|
setting this to `standard` for cross language compatibility.
|
|
|
|
|
supported since PyMongo 2.7. Valid values are ``pythonLegacy`` (the default),
|
|
|
|
|
``javaLegacy``, ``csharpLegacy`` and ``standard``. New applications should consider
|
|
|
|
|
setting this to ``standard`` for cross language compatibility.
|
|
|
|
|
- :class:`~bson.raw_bson.RawBSONDocument` now validates that the ``bson_bytes``
|
|
|
|
|
passed in represent a single bson document. Earlier versions would mistakenly
|
|
|
|
|
accept multiple bson documents.
|
|
|
|
|
@ -1305,7 +1305,7 @@ Version 3.7 adds support for MongoDB 4.0. Highlights include:
|
|
|
|
|
:ref:`PLAIN <sasl_plain>`, and :ref:`MONGODB-X509 <mongodb_x509>`
|
|
|
|
|
mechanisms can also be used to avoid issues with OpenSSL in FIPS
|
|
|
|
|
environments.
|
|
|
|
|
- MD5 checksums are now optional in GridFS. See the `disable_md5` option
|
|
|
|
|
- MD5 checksums are now optional in GridFS. See the ``disable_md5`` option
|
|
|
|
|
of :class:`~gridfs.GridFS` and :class:`~gridfs.GridFSBucket`.
|
|
|
|
|
- :class:`~bson.objectid.ObjectId` machine bytes are now hashed using
|
|
|
|
|
`FNV-1a
|
|
|
|
|
@ -1324,7 +1324,7 @@ Version 3.7 adds support for MongoDB 4.0. Highlights include:
|
|
|
|
|
authentication mechanism defaults to $external.
|
|
|
|
|
- wtimeoutMS is once again supported as a URI option.
|
|
|
|
|
- When using unacknowledged write concern and connected to MongoDB server
|
|
|
|
|
version 3.6 or greater, the `bypass_document_validation` option is now
|
|
|
|
|
version 3.6 or greater, the ``bypass_document_validation`` option is now
|
|
|
|
|
supported in the following write helpers:
|
|
|
|
|
:meth:`~pymongo.collection.Collection.insert_one`,
|
|
|
|
|
:meth:`~pymongo.collection.Collection.replace_one`,
|
|
|
|
|
@ -1334,7 +1334,7 @@ Version 3.7 adds support for MongoDB 4.0. Highlights include:
|
|
|
|
|
Deprecations:
|
|
|
|
|
|
|
|
|
|
- Deprecated :meth:`pymongo.collection.Collection.count` and
|
|
|
|
|
:meth:`pymongo.cursor.Cursor.count`. These two methods use the `count`
|
|
|
|
|
:meth:`pymongo.cursor.Cursor.count`. These two methods use the ``count``
|
|
|
|
|
command and `may or may not be accurate
|
|
|
|
|
<https://mongodb.com/docs/manual/reference/command/count/#behavior>`_,
|
|
|
|
|
depending on the options used and connected MongoDB topology. Use
|
|
|
|
|
@ -1344,7 +1344,7 @@ Deprecations:
|
|
|
|
|
deprecated in MongoDB 3.6 and removed in MongoDB 4.0.
|
|
|
|
|
- Deprecated the max_scan option of :meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
and :meth:`~pymongo.collection.Collection.find_one`. The option was
|
|
|
|
|
deprecated in MongoDB 4.0. Use `maxTimeMS` instead.
|
|
|
|
|
deprecated in MongoDB 4.0. Use ``maxTimeMS`` instead.
|
|
|
|
|
- Deprecated :meth:`~pymongo.mongo_client.MongoClient.close_cursor`. Use
|
|
|
|
|
:meth:`~pymongo.cursor.Cursor.close` instead.
|
|
|
|
|
- Deprecated :meth:`~pymongo.mongo_client.MongoClient.database_names`. Use
|
|
|
|
|
@ -1446,7 +1446,7 @@ Highlights include:
|
|
|
|
|
|
|
|
|
|
Deprecations:
|
|
|
|
|
|
|
|
|
|
- The `useCursor` option for :meth:`~pymongo.collection.Collection.aggregate`
|
|
|
|
|
- The ``useCursor`` option for :meth:`~pymongo.collection.Collection.aggregate`
|
|
|
|
|
is deprecated. The option was only necessary when upgrading from MongoDB
|
|
|
|
|
2.4 to MongoDB 2.6. MongoDB 2.4 is no longer supported.
|
|
|
|
|
- The :meth:`~pymongo.database.Database.add_user` and
|
|
|
|
|
@ -1511,13 +1511,13 @@ Highlights include:
|
|
|
|
|
- Increased the performance of using :class:`~bson.raw_bson.RawBSONDocument`.
|
|
|
|
|
- Increased the performance of
|
|
|
|
|
:meth:`~pymongo.mongo_client.MongoClient.database_names` by using the
|
|
|
|
|
`nameOnly` option for listDatabases when available.
|
|
|
|
|
``nameOnly`` option for listDatabases when available.
|
|
|
|
|
- Increased the performance of
|
|
|
|
|
:meth:`~pymongo.collection.Collection.bulk_write` by reducing the memory
|
|
|
|
|
overhead of :class:`~pymongo.operations.InsertOne`,
|
|
|
|
|
:class:`~pymongo.operations.DeleteOne`, and
|
|
|
|
|
:class:`~pymongo.operations.DeleteMany`.
|
|
|
|
|
- Added the `collation` option to :class:`~pymongo.operations.DeleteOne`,
|
|
|
|
|
- Added the ``collation`` option to :class:`~pymongo.operations.DeleteOne`,
|
|
|
|
|
:class:`~pymongo.operations.DeleteMany`,
|
|
|
|
|
:class:`~pymongo.operations.ReplaceOne`,
|
|
|
|
|
:class:`~pymongo.operations.UpdateOne`, and
|
|
|
|
|
@ -1531,13 +1531,13 @@ Highlights include:
|
|
|
|
|
|
|
|
|
|
Changes and Deprecations:
|
|
|
|
|
|
|
|
|
|
- :meth:`~pymongo.collection.Collection.find` has new options `return_key`,
|
|
|
|
|
`show_record_id`, `snapshot`, `hint`, `max_time_ms`, `max_scan`, `min`, `max`,
|
|
|
|
|
and `comment`. Deprecated the option `modifiers`.
|
|
|
|
|
- :meth:`~pymongo.collection.Collection.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 :meth:`~pymongo.collection.Collection.group`. The group command
|
|
|
|
|
was deprecated in MongoDB 3.4 and is expected to be removed in MongoDB 3.6.
|
|
|
|
|
Applications should use :meth:`~pymongo.collection.Collection.aggregate`
|
|
|
|
|
with the `$group` pipeline stage instead.
|
|
|
|
|
with the ``$group`` pipeline stage instead.
|
|
|
|
|
- Deprecated :meth:`~pymongo.database.Database.authenticate`. Authenticating
|
|
|
|
|
multiple users conflicts with support for logical sessions in MongoDB 3.6.
|
|
|
|
|
To authenticate as multiple users, create multiple instances of
|
|
|
|
|
@ -1547,9 +1547,9 @@ Changes and Deprecations:
|
|
|
|
|
- Deprecated :class:`~pymongo.database.SystemJS`.
|
|
|
|
|
- Deprecated :meth:`~pymongo.mongo_client.MongoClient.get_default_database`.
|
|
|
|
|
Applications should use
|
|
|
|
|
:meth:`~pymongo.mongo_client.MongoClient.get_database` without the `name`
|
|
|
|
|
:meth:`~pymongo.mongo_client.MongoClient.get_database` without the ```name```
|
|
|
|
|
parameter instead.
|
|
|
|
|
- Deprecated the MongoClient option `socketKeepAlive`. It now defaults to true
|
|
|
|
|
- Deprecated the MongoClient option ``socketKeepAlive```. It now defaults to true
|
|
|
|
|
and disabling it is not recommended, see `does TCP keepalive time affect
|
|
|
|
|
MongoDB Deployments?
|
|
|
|
|
<https://mongodb.com/docs/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments->`_
|
|
|
|
|
@ -1561,7 +1561,7 @@ Changes and Deprecations:
|
|
|
|
|
:const:`~bson.json_util.RELAXED_JSON_OPTIONS` or
|
|
|
|
|
:const:`~bson.json_util.CANONICAL_JSON_OPTIONS` instead.
|
|
|
|
|
- If a custom :class:`~bson.codec_options.CodecOptions` is passed to
|
|
|
|
|
:class:`RawBSONDocument`, its `document_class` must be
|
|
|
|
|
:class:`RawBSONDocument`, its ``document_class``` must be
|
|
|
|
|
:class:`RawBSONDocument`.
|
|
|
|
|
- :meth:`~pymongo.collection.Collection.list_indexes` no longer raises
|
|
|
|
|
OperationFailure when the collection (or database) does not exist on
|
|
|
|
|
@ -1706,7 +1706,7 @@ Changes in Version 3.2.2
|
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
@ -1750,7 +1750,7 @@ Highlights include:
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find_one_and_replace`,
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find_one_and_update`, and
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find_one_and_delete`.
|
|
|
|
|
- Support for the new `bypassDocumentValidation` option in write
|
|
|
|
|
- Support for the new ``bypassDocumentValidation`` option in write
|
|
|
|
|
helpers.
|
|
|
|
|
|
|
|
|
|
- Support for reading and writing raw BSON with
|
|
|
|
|
@ -1794,10 +1794,10 @@ Highlights include:
|
|
|
|
|
|
|
|
|
|
- Command monitoring support. See :mod:`~pymongo.monitoring` for details.
|
|
|
|
|
- Configurable error handling for :exc:`UnicodeDecodeError`. See the
|
|
|
|
|
`unicode_decode_error_handler` option of
|
|
|
|
|
``unicode_decode_error_handler`` option of
|
|
|
|
|
:class:`~bson.codec_options.CodecOptions`.
|
|
|
|
|
- Optional automatic timezone conversion when decoding BSON datetime. See the
|
|
|
|
|
`tzinfo` option of :class:`~bson.codec_options.CodecOptions`.
|
|
|
|
|
``tzinfo`` option of :class:`~bson.codec_options.CodecOptions`.
|
|
|
|
|
- An implementation of :class:`~gridfs.GridFSBucket` from the new GridFS spec.
|
|
|
|
|
- Compliance with the new Connection String spec.
|
|
|
|
|
- Reduced idle CPU usage in Python 2.
|
|
|
|
|
@ -1920,7 +1920,7 @@ applied to documents returned by the new methods
|
|
|
|
|
SSL/TLS changes
|
|
|
|
|
...............
|
|
|
|
|
|
|
|
|
|
When `ssl` is ``True`` the `ssl_cert_reqs` option now defaults to
|
|
|
|
|
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.
|
|
|
|
|
@ -2067,12 +2067,12 @@ Cursor management changes
|
|
|
|
|
: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
|
|
|
|
|
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`
|
|
|
|
|
:meth:`~pymongo.mongo_client.MongoClient.kill_cursors` now accepts an ``address``
|
|
|
|
|
parameter.
|
|
|
|
|
|
|
|
|
|
:class:`~pymongo.database.Database` changes
|
|
|
|
|
@ -2107,13 +2107,13 @@ The following methods have been added:
|
|
|
|
|
|
|
|
|
|
The following methods have been changed:
|
|
|
|
|
|
|
|
|
|
- :meth:`~pymongo.database.Database.command`. Support for `as_class`,
|
|
|
|
|
`uuid_subtype`, `tag_sets`, and `secondary_acceptable_latency_ms` have been
|
|
|
|
|
- :meth:`~pymongo.database.Database.command`. Support for ``as_class``,
|
|
|
|
|
``uuid_subtype``, ``tag_sets``, and ``secondary_acceptable_latency_ms`` have been
|
|
|
|
|
removed. You can instead pass an instance of
|
|
|
|
|
:class:`~bson.codec_options.CodecOptions` as `codec_options` and an instance
|
|
|
|
|
:class:`~bson.codec_options.CodecOptions` as ``codec_options`` and an instance
|
|
|
|
|
of a read preference class from :mod:`~pymongo.read_preferences` as
|
|
|
|
|
`read_preference`. The `fields` and `compile_re` options are also removed.
|
|
|
|
|
The `fields` options was undocumented and never really worked. Regular
|
|
|
|
|
``read_preference``. The ``fields`` and ``compile_re`` options are also removed.
|
|
|
|
|
The ``fields`` options was undocumented and never really worked. Regular
|
|
|
|
|
expressions are always decoded to :class:`~bson.regex.Regex`.
|
|
|
|
|
|
|
|
|
|
The following methods have been deprecated:
|
|
|
|
|
@ -2177,9 +2177,9 @@ The following methods have changed:
|
|
|
|
|
- :meth:`~pymongo.collection.Collection.distinct` now optionally takes a filter
|
|
|
|
|
argument.
|
|
|
|
|
- :meth:`~pymongo.collection.Collection.create_index` no longer caches
|
|
|
|
|
indexes, therefore the `cache_for` parameter has been removed. It also
|
|
|
|
|
no longer supports the `bucket_size` and `drop_dups` aliases for `bucketSize`
|
|
|
|
|
and `dropDups`.
|
|
|
|
|
indexes, therefore the ``cache_for`` parameter has been removed. It also
|
|
|
|
|
no longer supports the ``bucket_size`` and ``drop_dups`` aliases for ``bucketSize``
|
|
|
|
|
and ``dropDups``.
|
|
|
|
|
|
|
|
|
|
The following methods are deprecated:
|
|
|
|
|
|
|
|
|
|
@ -2227,13 +2227,13 @@ The following find/find_one options have been removed:
|
|
|
|
|
- tag_sets (use one of the read preference classes from
|
|
|
|
|
:mod:`~pymongo.read_preferences` and
|
|
|
|
|
:meth:`~pymongo.collection.Collection.with_options` instead)
|
|
|
|
|
- secondary_acceptable_latency_ms (use the `localThresholdMS` URI option
|
|
|
|
|
- secondary_acceptable_latency_ms (use the ``localThresholdMS`` URI option
|
|
|
|
|
instead)
|
|
|
|
|
- max_scan (use the new `modifiers` option instead)
|
|
|
|
|
- snapshot (use the new `modifiers` option instead)
|
|
|
|
|
- tailable (use the new `cursor_type` option instead)
|
|
|
|
|
- await_data (use the new `cursor_type` option instead)
|
|
|
|
|
- exhaust (use the new `cursor_type` option instead)
|
|
|
|
|
- max_scan (use the new ``modifiers`` option instead)
|
|
|
|
|
- snapshot (use the new ``modifiers`` option instead)
|
|
|
|
|
- tailable (use the new ``cursor_type`` option instead)
|
|
|
|
|
- await_data (use the new ``cursor_type`` option instead)
|
|
|
|
|
- exhaust (use the new ``cursor_type`` option instead)
|
|
|
|
|
- as_class (use :meth:`~pymongo.collection.Collection.with_options` with
|
|
|
|
|
:class:`~bson.codec_options.CodecOptions` instead)
|
|
|
|
|
- compile_re (BSON regular expressions are always decoded to
|
|
|
|
|
@ -2246,9 +2246,9 @@ The following find/find_one options are deprecated:
|
|
|
|
|
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 `timeout` you must pass
|
|
|
|
|
**True** for `no_cursor_timeout` to keep the previous behavior.
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
:mod:`~pymongo.errors` changes
|
|
|
|
|
..............................
|
|
|
|
|
@ -2265,7 +2265,7 @@ The unsupported methods, the class, and the exception are all deleted.
|
|
|
|
|
:mod:`~bson` changes
|
|
|
|
|
....................
|
|
|
|
|
|
|
|
|
|
The `compile_re` option is removed from all methods
|
|
|
|
|
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`,
|
|
|
|
|
@ -2283,7 +2283,7 @@ 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
|
|
|
|
|
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:
|
|
|
|
|
@ -2375,7 +2375,7 @@ 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`.
|
|
|
|
|
``DeprecationWarning``.
|
|
|
|
|
|
|
|
|
|
Issues Resolved
|
|
|
|
|
...............
|
|
|
|
|
@ -2683,7 +2683,7 @@ Important new features:
|
|
|
|
|
- Support aggregation output as a :class:`~pymongo.cursor.Cursor`. See
|
|
|
|
|
:meth:`~pymongo.collection.Collection.aggregate` for details.
|
|
|
|
|
|
|
|
|
|
.. warning:: SIGNIFICANT BEHAVIOR CHANGE in 2.6. Previously, `max_pool_size`
|
|
|
|
|
.. 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
|
|
|
|
|
@ -2808,7 +2808,7 @@ Important new features:
|
|
|
|
|
- :class:`~pymongo.cursor.Cursor` can be copied with functions from the :mod:`copy`
|
|
|
|
|
module.
|
|
|
|
|
- The :meth:`~pymongo.database.Database.set_profiling_level` method now supports
|
|
|
|
|
a `slow_ms` option.
|
|
|
|
|
a ``slow_ms`` option.
|
|
|
|
|
- The replica set monitor task (used by
|
|
|
|
|
:class:`~pymongo.mongo_replica_set_client.MongoReplicaSetClient` and
|
|
|
|
|
:class:`~pymongo.replica_set_connection.ReplicaSetConnection`) is a daemon thread
|
|
|
|
|
@ -3028,12 +3028,12 @@ Important New Features:
|
|
|
|
|
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
|
|
|
|
|
- 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.
|
|
|
|
|
- :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
|
|
|
|
|
@ -3045,9 +3045,9 @@ Important New Features:
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
@ -3072,7 +3072,7 @@ Version 1.11 adds a few new features and fixes a few more bugs.
|
|
|
|
|
New Features:
|
|
|
|
|
|
|
|
|
|
- Basic IPv6 support: pymongo prefers IPv4 but will try IPv6. You can
|
|
|
|
|
also specify an IPv6 address literal in the `host` parameter or a
|
|
|
|
|
also specify an IPv6 address literal in the ``host`` parameter or a
|
|
|
|
|
MongoDB URI provided it is enclosed in '[' and ']'.
|
|
|
|
|
- max_pool_size option: previously pymongo had a hard coded pool size
|
|
|
|
|
of 10 connections. With this change you can specify a different pool
|
|
|
|
|
@ -3090,10 +3090,10 @@ 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
|
|
|
|
|
``scandata`` and ``full`` parameters. See the documentation for more
|
|
|
|
|
details.
|
|
|
|
|
|
|
|
|
|
.. warning:: The `pool_size`, `auto_start_request`, and `timeout` parameters
|
|
|
|
|
.. 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
|
|
|
|
|
@ -3135,9 +3135,9 @@ There are two behavior changes to be aware of:
|
|
|
|
|
Previously the read would be sent to one randomly chosen slave and
|
|
|
|
|
:class:`~pymongo.errors.AutoReconnect` was immediately raised in case
|
|
|
|
|
of a connection failure.
|
|
|
|
|
- A Python `long` is now always BSON encoded as an int64. Previously the
|
|
|
|
|
encoding was based only on the value of the field and a `long` with a
|
|
|
|
|
value less than `2147483648` or greater than `-2147483649` would always
|
|
|
|
|
- A Python ``long`` is now always BSON encoded as an int64. Previously the
|
|
|
|
|
encoding was based only on the value of the field and a ``long`` with a
|
|
|
|
|
value less than ``2147483648`` or greater than ``-2147483649`` would always
|
|
|
|
|
be BSON encoded as an int32.
|
|
|
|
|
|
|
|
|
|
Issues resolved
|
|
|
|
|
@ -3182,7 +3182,7 @@ server for the maximum BSON document size it supports.
|
|
|
|
|
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.
|
|
|
|
|
requires the ``out`` parameter.
|
|
|
|
|
|
|
|
|
|
Issues resolved
|
|
|
|
|
...............
|
|
|
|
|
@ -3205,7 +3205,7 @@ Issues resolved
|
|
|
|
|
- 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.
|
|
|
|
|
- PYTHON-158: Add code and err string to ``db assertion`` messages.
|
|
|
|
|
|
|
|
|
|
Changes in Version 1.9
|
|
|
|
|
----------------------
|
|
|
|
|
@ -3282,7 +3282,7 @@ rather than :class:`pymongo.errors.PyMongoError`.
|
|
|
|
|
:class:`~pymongo.connection.Connection` has been idle for a while.
|
|
|
|
|
- added :meth:`~pymongo.database.SystemJS.list` to
|
|
|
|
|
:class:`~pymongo.database.SystemJS`.
|
|
|
|
|
- added `file_document` argument to :meth:`~gridfs.grid_file.GridOut`
|
|
|
|
|
- added ``file_document`` argument to :meth:`~gridfs.grid_file.GridOut`
|
|
|
|
|
to allow initializing from an existing file document.
|
|
|
|
|
- raise :class:`~pymongo.errors.TimeoutError` even if the
|
|
|
|
|
``getLastError`` command was run manually and not through "safe"
|
|
|
|
|
@ -3302,13 +3302,13 @@ Changes in Version 1.8
|
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
|
|
Version 1.8 adds support for connecting to replica sets, specifying
|
|
|
|
|
per-operation values for `w` and `wtimeout`, and decoding to
|
|
|
|
|
per-operation values for ``w`` and ``wtimeout``, and decoding to
|
|
|
|
|
timezone-aware datetimes.
|
|
|
|
|
|
|
|
|
|
- fixed a reference leak in the C extension when decoding a
|
|
|
|
|
:class:`~bson.dbref.DBRef`.
|
|
|
|
|
- added support for `w`, `wtimeout`, and `fsync` (and any other
|
|
|
|
|
options for `getLastError`) to "safe mode" operations.
|
|
|
|
|
- added support for ``w``, ``wtimeout``, and ``fsync`` (and any other
|
|
|
|
|
options for ``getLastError``) to "safe mode" operations.
|
|
|
|
|
- added :attr:`~pymongo.connection.Connection.nodes` property.
|
|
|
|
|
- added a maximum pool size of 10 sockets.
|
|
|
|
|
- added support for replica sets.
|
|
|
|
|
@ -3326,9 +3326,9 @@ timezone-aware datetimes.
|
|
|
|
|
:class:`~bson.max_key.MaxKey` and
|
|
|
|
|
:class:`~bson.timestamp.Timestamp` to :mod:`~bson.json_util`.
|
|
|
|
|
- added support for decoding datetimes as aware (UTC) - it is highly
|
|
|
|
|
recommended to enable this by setting the `tz_aware` parameter to
|
|
|
|
|
recommended to enable this by setting the ``tz_aware`` parameter to
|
|
|
|
|
:meth:`~pymongo.connection.Connection` to ``True``.
|
|
|
|
|
- added `network_timeout` option for individual calls to
|
|
|
|
|
- added ``network_timeout`` option for individual calls to
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find` and
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find_one`.
|
|
|
|
|
- added :meth:`~gridfs.GridFS.exists` to check if a file exists in
|
|
|
|
|
@ -3359,11 +3359,11 @@ highlights is `here
|
|
|
|
|
support for querying unique status and other index information.
|
|
|
|
|
- added :attr:`~pymongo.connection.Connection.document_class`, to
|
|
|
|
|
specify class for returned documents.
|
|
|
|
|
- added `as_class` argument for
|
|
|
|
|
- added ``as_class`` argument for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find`, and in the BSON decoder.
|
|
|
|
|
- added support for creating :class:`~bson.timestamp.Timestamp`
|
|
|
|
|
instances using a :class:`~datetime.datetime`.
|
|
|
|
|
- allow `dropTarget` argument for
|
|
|
|
|
- allow ``dropTarget`` argument for
|
|
|
|
|
:class:`~pymongo.collection.Collection.rename`.
|
|
|
|
|
- handle aware :class:`~datetime.datetime` instances, by converting to
|
|
|
|
|
UTC.
|
|
|
|
|
@ -3373,13 +3373,13 @@ highlights is `here
|
|
|
|
|
- use `y2038 <https://github.com/evalEmpire/y2038/>`_ for time handling in
|
|
|
|
|
the C extension - eliminates 2038 problems when extension is
|
|
|
|
|
installed.
|
|
|
|
|
- added `sort` parameter to
|
|
|
|
|
- added ``sort`` parameter to
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
- finalized deprecation of changes from versions **<= 1.4**
|
|
|
|
|
- take any non-:class:`dict` as an ``"_id"`` query for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find_one` or
|
|
|
|
|
:meth:`~pymongo.collection.Collection.remove`
|
|
|
|
|
- added ability to pass a :class:`dict` for `fields` argument to
|
|
|
|
|
- added ability to pass a :class:`dict` for ``fields`` argument to
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find` (supports ``"$slice"``
|
|
|
|
|
and field negation)
|
|
|
|
|
- simplified code to find master, since paired setups don't always have
|
|
|
|
|
@ -3421,7 +3421,7 @@ Changes in Version 1.5.1
|
|
|
|
|
- added :data:`~gridfs.grid_file.GridFile._id` property for
|
|
|
|
|
:class:`~gridfs.grid_file.GridFile` instances.
|
|
|
|
|
- fix for making a :class:`~pymongo.connection.Connection` (with
|
|
|
|
|
`slave_okay` set) directly to a slave in a replica pair.
|
|
|
|
|
``slave_okay`` set) directly to a slave in a replica pair.
|
|
|
|
|
- accept kwargs for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.create_index` and
|
|
|
|
|
:meth:`~pymongo.collection.Collection.ensure_index` to support all
|
|
|
|
|
@ -3433,7 +3433,7 @@ Changes in Version 1.5.1
|
|
|
|
|
Changes in Version 1.5
|
|
|
|
|
----------------------
|
|
|
|
|
- added subtype constants to :mod:`~bson.binary` module.
|
|
|
|
|
- DEPRECATED `options` argument to
|
|
|
|
|
- DEPRECATED ``options`` argument to
|
|
|
|
|
:meth:`~pymongo.collection.Collection` and
|
|
|
|
|
:meth:`~pymongo.database.Database.create_collection` in favor of
|
|
|
|
|
kwargs.
|
|
|
|
|
@ -3443,7 +3443,7 @@ Changes in Version 1.5
|
|
|
|
|
might have more data to return (useful for tailable cursors).
|
|
|
|
|
- added :class:`~bson.timestamp.Timestamp` to better support
|
|
|
|
|
dealing with internal MongoDB timestamps.
|
|
|
|
|
- added `name` argument for
|
|
|
|
|
- added ``name`` argument for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.create_index` and
|
|
|
|
|
:meth:`~pymongo.collection.Collection.ensure_index`.
|
|
|
|
|
- fixed connection pooling w/ fork
|
|
|
|
|
@ -3495,7 +3495,7 @@ Other changes:
|
|
|
|
|
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
|
|
|
|
|
:meth:`~pymongo.collection.Collection.update` with ``safe`` set to
|
|
|
|
|
``True``.
|
|
|
|
|
- removed :mod:`~pymongo.thread_util`.
|
|
|
|
|
- added :meth:`~pymongo.database.Database.add_user` and
|
|
|
|
|
@ -3508,7 +3508,7 @@ Other changes:
|
|
|
|
|
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`
|
|
|
|
|
- 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`.
|
|
|
|
|
@ -3519,7 +3519,7 @@ Other changes:
|
|
|
|
|
- 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
|
|
|
|
|
- support string as ``key`` argument to
|
|
|
|
|
:meth:`~pymongo.collection.Collection.group` (keyf) and run all
|
|
|
|
|
groups as commands.
|
|
|
|
|
- support for equality testing for :class:`~bson.code.Code`
|
|
|
|
|
@ -3567,7 +3567,7 @@ Changes in Version 1.2.1
|
|
|
|
|
|
|
|
|
|
Changes in Version 1.2
|
|
|
|
|
----------------------
|
|
|
|
|
- `spec` parameter for :meth:`~pymongo.collection.Collection.remove` is
|
|
|
|
|
- ``spec`` parameter for :meth:`~pymongo.collection.Collection.remove` is
|
|
|
|
|
now optional to allow for deleting all documents in a
|
|
|
|
|
:class:`~pymongo.collection.Collection`
|
|
|
|
|
- always wrap queries with ``{query: ...}`` even when no special options -
|
|
|
|
|
@ -3601,15 +3601,15 @@ Changes in Version 1.1.2
|
|
|
|
|
|
|
|
|
|
Changes in Version 1.1.1
|
|
|
|
|
------------------------
|
|
|
|
|
- added `multi` parameter for
|
|
|
|
|
- added ``multi`` parameter for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.update`
|
|
|
|
|
- fix unicode regex patterns with C extension
|
|
|
|
|
- added :meth:`~pymongo.collection.Collection.distinct`
|
|
|
|
|
- added `database` support for :class:`~bson.dbref.DBRef`
|
|
|
|
|
- added ``database`` support for :class:`~bson.dbref.DBRef`
|
|
|
|
|
- added :mod:`~bson.json_util` with helpers for encoding / decoding
|
|
|
|
|
special types to JSON
|
|
|
|
|
- DEPRECATED :meth:`pymongo.cursor.Cursor.__len__` in favor of
|
|
|
|
|
:meth:`~pymongo.cursor.Cursor.count` with `with_limit_and_skip` set
|
|
|
|
|
:meth:`~pymongo.cursor.Cursor.count` with ``with_limit_and_skip`` set
|
|
|
|
|
to ``True`` due to performance regression
|
|
|
|
|
- switch documentation to Sphinx
|
|
|
|
|
|
|
|
|
|
@ -3622,18 +3622,18 @@ Changes in Version 1.1
|
|
|
|
|
- fix :class:`~bson.objectid.ObjectId` generation when using
|
|
|
|
|
:mod:`multiprocessing`
|
|
|
|
|
- added :attr:`~pymongo.cursor.Cursor.collection`
|
|
|
|
|
- added `network_timeout` parameter for
|
|
|
|
|
- added ``network_timeout`` parameter for
|
|
|
|
|
:meth:`~pymongo.connection.Connection`
|
|
|
|
|
- DEPRECATED `slave_okay` parameter for individual queries
|
|
|
|
|
- fix for `safe` mode when multi-threaded
|
|
|
|
|
- added `safe` parameter for :meth:`~pymongo.collection.Collection.remove`
|
|
|
|
|
- added `tailable` parameter for :meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
- DEPRECATED ``slave_okay`` parameter for individual queries
|
|
|
|
|
- fix for ``safe`` mode when multi-threaded
|
|
|
|
|
- added ``safe`` parameter for :meth:`~pymongo.collection.Collection.remove`
|
|
|
|
|
- added ``tailable`` parameter for :meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
|
|
|
|
|
Changes in Version 1.0
|
|
|
|
|
----------------------
|
|
|
|
|
- fixes for
|
|
|
|
|
:class:`~pymongo.master_slave_connection.MasterSlaveConnection`
|
|
|
|
|
- added `finalize` parameter for :meth:`~pymongo.collection.Collection.group`
|
|
|
|
|
- added ``finalize`` parameter for :meth:`~pymongo.collection.Collection.group`
|
|
|
|
|
- improvements to :meth:`~pymongo.collection.Collection.insert` speed
|
|
|
|
|
- improvements to :mod:`gridfs` speed
|
|
|
|
|
- added :meth:`~pymongo.cursor.Cursor.__getitem__` and
|
|
|
|
|
@ -3663,9 +3663,9 @@ Changes in Version 0.15
|
|
|
|
|
-----------------------
|
|
|
|
|
- fix string representation of :class:`~bson.objectid.ObjectId`
|
|
|
|
|
instances
|
|
|
|
|
- added `timeout` parameter for
|
|
|
|
|
- added ``timeout`` parameter for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
- allow scope for `reduce` function in
|
|
|
|
|
- allow scope for ``reduce`` function in
|
|
|
|
|
:meth:`~pymongo.collection.Collection.group`
|
|
|
|
|
|
|
|
|
|
Changes in Version 0.14.2
|
|
|
|
|
@ -3682,7 +3682,7 @@ Changes in Version 0.14
|
|
|
|
|
-----------------------
|
|
|
|
|
- support for long in :class:`~bson.BSON`
|
|
|
|
|
- added :meth:`~pymongo.collection.Collection.rename`
|
|
|
|
|
- added `snapshot` parameter for
|
|
|
|
|
- added ``snapshot`` parameter for
|
|
|
|
|
:meth:`~pymongo.collection.Collection.find`
|
|
|
|
|
|
|
|
|
|
Changes in Version 0.13
|
|
|
|
|
@ -3724,7 +3724,7 @@ Changes in Version 0.11
|
|
|
|
|
- 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`
|
|
|
|
|
- added ``timeout`` parameter for :meth:`~pymongo.connection.Connection`
|
|
|
|
|
|
|
|
|
|
Changes in Version 0.10.3
|
|
|
|
|
-------------------------
|
|
|
|
|
|