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:
255255 * - ``unspecified ``
256256 - :ref: `unspecified-representation-details `
257257
258- #. Using the ``uuid_representation `` kwarg option, e.g.::
258+ #. At the ``MongoClient `` level using the ``uuidRepresentation `` kwarg
259+ option, e.g.::
259260
260261 from bson.binary import UuidRepresentation
261- client = MongoClient(uuid_representation =UuidRepresentation.PYTHON_LEGACY)
262+ client = MongoClient(uuidRepresentation =UuidRepresentation.PYTHON_LEGACY)
262263
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.::
265266
266267 from bson.codec_options import CodecOptions
267268 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
268272 csharp_database = client.get_database('csharp_db', codec_options=csharp_opts)
269273 csharp_collection = client.testdb.get_collection('csharp_coll', codec_options=csharp_opts)
270274
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+
271279Supported UUID Representations
272280------------------------------
273281
You can’t perform that action at this time.
0 commit comments