diff --git a/bson/binary.py b/bson/binary.py index 96cb562c2..b752e599a 100644 --- a/bson/binary.py +++ b/bson/binary.py @@ -68,8 +68,9 @@ change to this in a future release. """ JAVA_LEGACY = 5 -"""Specify that UUIDs should be stored in the legacy -byte order used by the Java driver. +"""Used with :attr:`pymongo.collection.Collection.uuid_subtype` +to specify that UUIDs should be stored in the legacy byte order +used by the Java driver. :class:`uuid.UUID` instances will automatically be encoded by :mod:`bson` using :data:`OLD_UUID_SUBTYPE`. @@ -78,8 +79,9 @@ by :mod:`bson` using :data:`OLD_UUID_SUBTYPE`. """ CSHARP_LEGACY = 6 -"""Specify that UUIDs should be stored in the legacy -byte order used by the C# driver. +"""Used with :attr:`pymongo.collection.Collection.uuid_subtype` +to specify that UUIDs should be stored in the legacy byte order +used by the C# driver. :class:`uuid.UUID` instances will automatically be encoded by :mod:`bson` using :data:`OLD_UUID_SUBTYPE`. diff --git a/bson/objectid.py b/bson/objectid.py index 05d3d65e0..ae0efea5a 100644 --- a/bson/objectid.py +++ b/bson/objectid.py @@ -130,7 +130,7 @@ class ObjectId(object): :Parameters: - `oid`: the object id to validate - .. versionadded:: 2.2.1+ + .. versionadded:: 2.3 """ try: ObjectId(oid) diff --git a/doc/api/bson/binary.rst b/doc/api/bson/binary.rst index 0b3d6d3d3..57b87255f 100644 --- a/doc/api/bson/binary.rst +++ b/doc/api/bson/binary.rst @@ -7,8 +7,10 @@ .. autodata:: BINARY_SUBTYPE .. autodata:: FUNCTION_SUBTYPE .. autodata:: OLD_BINARY_SUBTYPE - .. autodata:: UUID_SUBTYPE .. autodata:: OLD_UUID_SUBTYPE + .. autodata:: UUID_SUBTYPE + .. autodata:: JAVA_LEGACY + .. autodata:: CSHARP_LEGACY .. autodata:: MD5_SUBTYPE .. autodata:: USER_DEFINED_SUBTYPE diff --git a/doc/changelog.rst b/doc/changelog.rst index 004c3e5f8..dc40988e2 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -16,6 +16,7 @@ Important New Features: - A new :meth:`~pymongo.collection.Collection.aggregate` method to support MongoDB's new `aggregation framework `_. +- Support for legacy Java and C# byte order when encoding and decoding UUIDs. - Support for connecting directly to an arbiter. .. warning:: diff --git a/pymongo/collection.py b/pymongo/collection.py index 70a27fb63..9671a7f65 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -182,14 +182,14 @@ class Collection(common.BaseObject): self.__uuid_subtype = subtype uuid_subtype = property(__get_uuid_subtype, __set_uuid_subtype, - doc="""This setting specifies which BSON Binary + doc="""This attribute specifies which BSON Binary subtype is used when storing UUIDs. Historically UUIDs have been stored as BSON Binary subtype 3. - This setting is used to switch to the newer BSON - binary subtype 4. This setting can also be used to - force legacy byte order and subtype compatibility - with the Java and C# drivers. See the bson.binary - module for all options.""") + This attribute is used to switch to the newer BSON + binary subtype 4. It can also be used to force + legacy byte order and subtype compatibility with + the Java and C# drivers. See the + :mod:`bson.binary` module for all options.""") def save(self, to_save, manipulate=True, safe=None, check_keys=True, **kwargs): @@ -685,7 +685,7 @@ class Collection(common.BaseObject): arguments - `ttl` (deprecated): Use `cache_for` instead. - .. versionchanged:: 2.2.1+ + .. versionchanged:: 2.3 The `ttl` parameter has been deprecated to avoid confusion with TTL collections. Use `cache_for` instead. @@ -787,7 +787,7 @@ class Collection(common.BaseObject): arguments - `ttl` (deprecated): Use `cache_for` instead. - .. versionchanged:: 2.2.1+ + .. versionchanged:: 2.3 The `ttl` parameter has been deprecated to avoid confusion with TTL collections. Use `cache_for` instead.