3.5 changelog and documentation fixes.

This commit is contained in:
Shane Harvey 2017-08-02 17:17:55 -07:00 committed by Shane Harvey
parent 6e022e0636
commit b7893b7ec4
9 changed files with 60 additions and 14 deletions

View File

@ -114,12 +114,12 @@ class CodecOptions(_options_base):
def with_options(self, **kwargs):
"""Make a copy of this CodecOptions, overriding some options::
>>> from bson.codec_options import DEFAULT_CODEC_OPTIONS
>>> DEFAULT_CODEC_OPTIONS.tz_aware
False
>>> options = DEFAULT_CODEC_OPTIONS.with_options(tz_aware=True)
>>> options.tz_aware
True
>>> from bson.codec_options import DEFAULT_CODEC_OPTIONS
>>> DEFAULT_CODEC_OPTIONS.tz_aware
False
>>> options = DEFAULT_CODEC_OPTIONS.with_options(tz_aware=True)
>>> options.tz_aware
True
.. versionadded:: 3.5
"""

View File

@ -408,11 +408,19 @@ def loads(s, *args, **kwargs):
Automatically passes the object_hook for BSON type conversion.
Raises ``TypeError``, ``ValueError``, ``KeyError``, or
:exc:`~bson.errors.InvalidId` on invalid MongoDB Extended JSON.
:Parameters:
- `json_options`: A :class:`JSONOptions` instance used to modify the
decoding of MongoDB Extended JSON types. Defaults to
:const:`DEFAULT_JSON_OPTIONS`.
.. versionchanged:: 3.5
Parses Relaxed and Canonical Extended JSON as well as PyMongo's legacy
format. Now raises ``TypeError`` or ``ValueError`` when parsing JSON
type wrappers with values of the wrong type or any extra keys.
.. versionchanged:: 3.4
Accepts optional parameter `json_options`. See :class:`JSONOptions`.
"""

View File

@ -1,5 +1,5 @@
:mod:`errors` -- Exceptions raised by the :mod:`bson` package
================================================================
=============================================================
.. automodule:: bson.errors
:synopsis: Exceptions raised by the bson package

View File

@ -1,5 +1,5 @@
:mod:`json_util` -- Tools for using Python's :mod:`json` module with BSON documents
======================================================================================
===================================================================================
.. automodule:: bson.json_util
:synopsis: Tools for using Python's json module with BSON documents
:members:

View File

@ -6,6 +6,9 @@
.. autoclass:: pymongo.read_preferences.Primary
.. max_staleness, min_wire_version, mongos_mode, and tag_sets don't
make sense for Primary.
.. autoattribute:: document
.. autoattribute:: mode
.. autoattribute:: name

View File

@ -4,15 +4,18 @@ Changelog
Changes in Version 3.5
----------------------
Highlights:
Version 3.5 implements a number of improvements and bug fixes:
Highlights include:
- Increase the performance of
:meth:`~pymongo.mongo_client.MongoClient.database_names` by using the
`nameOnly` option for listDatabases when available.
- Username and password can be passed to
:class:`~pymongo.mongo_client.MongoClient` as keyword arguments. Before, the
only way to pass them was in the URI.
- Increase the performance of
- 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.
- 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
@ -22,6 +25,12 @@ Highlights:
:class:`~pymongo.operations.ReplaceOne`,
:class:`~pymongo.operations.UpdateOne`, and
:class:`~pymongo.operations.UpdateMany`.
- Implemented the `MongoDB Extended JSON
<https://github.com/mongodb/specifications/blob/master/source/extended-json.rst>`_
specification.
- :class:`~bson.decimal128.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:
@ -63,8 +72,25 @@ Changes and Deprecations:
:class:`~pymongo.command_cursor.CommandCursor` to make the behavior
consistent across all MongoDB versions.
- In Python 3, :meth:`~bson.json_util.loads` now automatically decodes JSON
binary with a subtype of 0 into :class:`bytes` instead of
$binary with a subtype of 0 into :class:`bytes` instead of
:class:`~bson.binary.Binary`. See the :doc:`/python3` for more details.
- :meth:`~bson.json_util.loads` now raises ``TypeError`` or ``ValueError``
when parsing JSON type wrappers with values of the wrong type or any
extra keys.
- :meth:`pymongo.cursor.Cursor.close` and
:meth:`pymongo.mongo_client.MongoClient.close`
now kill cursors synchronously instead of deferring to a background thread.
- :meth:`~pymongo.uri_parser.parse_uri` now returns the original value
of the ``readPreference`` MongoDB URI option instead of the validated read
preference mode.
Issues Resolved
...............
See the `PyMongo 3.5 release notes in JIRA`_ for the list of resolved issues
in this release.
.. _PyMongo 3.5 release notes in JIRA: https://jira.mongodb.org/projects/PYTHON/versions/17590
Changes in Version 3.4
----------------------

View File

@ -78,3 +78,4 @@ The following is a list of people who have contributed to
- Anna Herlihy (aherlihy)
- Len Buckens (buckensl)
- ultrabug
- Shane Harvey (ShaneHarvey)

View File

@ -303,6 +303,10 @@ def validate_read_preference(dummy, value):
def validate_read_preference_mode(dummy, value):
"""Validate read preference mode for a MongoReplicaSetClient.
.. versionchanged:: 3.5
Returns the original ``value`` instead of the validated read preference
mode.
"""
if value not in _MONGOS_MODES:
raise ValueError("%s is not a valid read preference" % (value,))

View File

@ -283,6 +283,10 @@ def parse_uri(uri, default_port=DEFAULT_PORT, validate=True, warn=False):
validation will error when options are unsupported or values are
invalid.
.. versionchanged:: 3.5
Return the original value of the ``readPreference`` MongoDB URI option
instead of the validated read preference mode.
.. versionchanged:: 3.1
``warn`` added so invalid options can be ignored.
"""