File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -255,19 +255,27 @@ Applications can set the UUID representation in one of the following ways:
255
255
* - ``unspecified ``
256
256
- :ref: `unspecified-representation-details `
257
257
258
- #. Using the ``uuid_representation `` kwarg option, e.g.::
258
+ #. At the ``MongoClient `` level using the ``uuidRepresentation `` kwarg
259
+ option, e.g.::
259
260
260
261
from bson.binary import UuidRepresentation
261
- client = MongoClient(uuid_representation =UuidRepresentation.PYTHON_LEGACY)
262
+ client = MongoClient(uuidRepresentation =UuidRepresentation.PYTHON_LEGACY)
262
263
263
- #. By supplying a suitable :class: ` ~bson.codec_options.CodecOptions `
264
- instance, e.g.::
264
+ #. At the `` Database `` or `` Collection `` level by supplying a suitable
265
+ :class: ` ~bson.codec_options.CodecOptions ` instance, e.g.::
265
266
266
267
from bson.codec_options import CodecOptions
267
268
csharp_opts = CodecOptions(uuid_representation=UuidRepresentation.CSHARP_LEGACY)
269
+ java_opts = CodecOptions(uuid_representation=UuidRepresentation.JAVA_LEGACY)
270
+
271
+ # Get database/collection from client with csharpLegacy UUID representation
268
272
csharp_database = client.get_database('csharp_db', codec_options=csharp_opts)
269
273
csharp_collection = client.testdb.get_collection('csharp_coll', codec_options=csharp_opts)
270
274
275
+ # Get database/collection from existing database/collection with javaLegacy UUID representation
276
+ java_database = csharp_database.with_options(codec_options=java_opts)
277
+ java_collection = csharp_collection.with_options(codec_options=java_opts)
278
+
271
279
Supported UUID Representations
272
280
------------------------------
273
281
You can’t perform that action at this time.
0 commit comments