diff --git a/doc/examples/uuid.rst b/doc/examples/uuid.rst index d4a77d4038..90ec71ebe2 100644 --- a/doc/examples/uuid.rst +++ b/doc/examples/uuid.rst @@ -1,3 +1,4 @@ + .. _handling-uuid-data-example: Handling UUID Data @@ -12,7 +13,7 @@ to MongoDB and retrieve them as native :class:`uuid.UUID` objects:: from uuid import uuid4 # use the 'standard' representation for cross-language compatibility. - client = MongoClient(uuid_representation=UuidRepresentation.STANDARD) + client = MongoClient(uuidRepresentation='standard') collection = client.get_database('uuid_db').get_collection('uuid_coll') # remove all documents from collection diff --git a/pymongo/mongo_client.py b/pymongo/mongo_client.py index af159da521..dae62e7605 100644 --- a/pymongo/mongo_client.py +++ b/pymongo/mongo_client.py @@ -325,9 +325,9 @@ def __init__( speed. 9 is best compression. Defaults to -1. - `uuidRepresentation`: The BSON representation to use when encoding from and decoding to instances of :class:`~uuid.UUID`. Valid - values are `pythonLegacy`, `javaLegacy`, `csharpLegacy`, `standard` - and `unspecified` (the default). New applications - should consider setting this to `standard` for cross language + values are the strings: "standard", "pythonLegacy", "javaLegacy", + "csharpLegacy", and "unspecified" (the default). New applications + should consider setting this to "standard" for cross language compatibility. See :ref:`handling-uuid-data-example` for details. - `unicode_decode_error_handler`: The error handler to apply when a Unicode-related error occurs during BSON decoding that would