Skip to content

Commit 72b5ceb

Browse files
authored
Change default UUID representation from JAVA_LEGACY to UNSPECIFIED (#528)
* Change default UUID representation from JAVA_LEGACY to UNSPECIFIED This commit changes the default BSON representation of java.util.UUID values from JAVA_LEGACY (BSON binary subtype 3 with the Java driver's legacy byte order) to UNSPECIFIED. This forces applications that encode or decode documents from MongoDB that contain java.util.UUID values to explicitly specify the UUID representation that they want to use. Typically, a new application would choose the STANDARD (BSON binary subtype 4) representation, while an existing application upgrading to the 4.0 driver would choose JAVA_LEGACY. Applications that do not use UUID values (preferring ObjectId, for example) are not required to specify the UUID representation. Applications can specify the UUID representation either with the uuidRepresentation connection string parameter or the uuidRepresentation property on MongoClientSettings or MongoClientOptions. JAVA-3518
1 parent d134369 commit 72b5ceb

30 files changed

+139
-138
lines changed

bson/src/main/org/bson/LazyBSONObject.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.bson;
1818

19-
import org.bson.codecs.DecoderContext;
20-
import org.bson.codecs.UuidCodec;
2119
import org.bson.io.ByteBufferBsonInput;
2220
import org.bson.types.BSONTimestamp;
2321
import org.bson.types.Binary;
@@ -169,9 +167,6 @@ Object readValue(final BsonBinaryReader reader) {
169167
return reader.readString();
170168
case BINARY:
171169
byte binarySubType = reader.peekBinarySubType();
172-
if (BsonBinarySubType.isUuid(binarySubType) && reader.peekBinarySize() == 16) {
173-
return new UuidCodec(UuidRepresentation.JAVA_LEGACY).decode(reader, DecoderContext.builder().build());
174-
}
175170
BsonBinary binary = reader.readBinaryData();
176171
if (binarySubType == BINARY.getValue() || binarySubType == OLD_BINARY.getValue()) {
177172
return binary.getData();

bson/src/main/org/bson/codecs/DocumentCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public DocumentCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTy
9494
*/
9595
public DocumentCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap, final Transformer valueTransformer) {
9696
this(registry, new BsonTypeCodecMap(notNull("bsonTypeClassMap", bsonTypeClassMap), registry),
97-
new ObjectIdGenerator(), valueTransformer, UuidRepresentation.JAVA_LEGACY);
97+
new ObjectIdGenerator(), valueTransformer, UuidRepresentation.UNSPECIFIED);
9898
}
9999

100100
private DocumentCodec(final CodecRegistry registry, final BsonTypeCodecMap bsonTypeCodecMap, final IdGenerator idGenerator,
@@ -242,7 +242,7 @@ private Object readValue(final BsonReader reader, final DecoderContext decoderCo
242242
}
243243
break;
244244
case 4:
245-
if (uuidRepresentation == UuidRepresentation.JAVA_LEGACY || uuidRepresentation == UuidRepresentation.STANDARD) {
245+
if (uuidRepresentation == UuidRepresentation.STANDARD) {
246246
codec = registry.get(UUID.class);
247247
}
248248
break;

bson/src/main/org/bson/codecs/IterableCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public IterableCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTy
6161
*/
6262
public IterableCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap, final Transformer valueTransformer) {
6363
this(registry, new BsonTypeCodecMap(notNull("bsonTypeClassMap", bsonTypeClassMap), registry), valueTransformer,
64-
UuidRepresentation.JAVA_LEGACY);
64+
UuidRepresentation.UNSPECIFIED);
6565
}
6666

6767
private IterableCodec(final CodecRegistry registry, final BsonTypeCodecMap bsonTypeCodecMap, final Transformer valueTransformer,
@@ -138,7 +138,7 @@ private Object readValue(final BsonReader reader, final DecoderContext decoderCo
138138
}
139139
break;
140140
case 4:
141-
if (uuidRepresentation == UuidRepresentation.JAVA_LEGACY || uuidRepresentation == UuidRepresentation.STANDARD) {
141+
if (uuidRepresentation == UuidRepresentation.STANDARD) {
142142
codec = registry.get(UUID.class);
143143
}
144144
break;

bson/src/main/org/bson/codecs/MapCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public MapCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeCla
8484
*/
8585
public MapCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap, final Transformer valueTransformer) {
8686
this(registry, new BsonTypeCodecMap(notNull("bsonTypeClassMap", bsonTypeClassMap), registry), valueTransformer,
87-
UuidRepresentation.JAVA_LEGACY);
87+
UuidRepresentation.UNSPECIFIED);
8888
}
8989

9090
private MapCodec(final CodecRegistry registry, final BsonTypeCodecMap bsonTypeCodecMap, final Transformer valueTransformer,
@@ -153,7 +153,7 @@ private Object readValue(final BsonReader reader, final DecoderContext decoderCo
153153
}
154154
break;
155155
case 4:
156-
if (uuidRepresentation == UuidRepresentation.JAVA_LEGACY || uuidRepresentation == UuidRepresentation.STANDARD) {
156+
if (uuidRepresentation == UuidRepresentation.STANDARD) {
157157
codec = registry.get(UUID.class);
158158
}
159159
break;

bson/src/main/org/bson/codecs/UuidCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public UuidCodec(final UuidRepresentation uuidRepresentation) {
5353
* The constructor for UUIDCodec, default is JAVA_LEGACY
5454
*/
5555
public UuidCodec() {
56-
this.uuidRepresentation = UuidRepresentation.JAVA_LEGACY;
56+
this.uuidRepresentation = UuidRepresentation.UNSPECIFIED;
5757
}
5858

5959
/**

bson/src/main/org/bson/internal/CodecRegistryHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class CodecRegistryHelper {
2525

2626
public static CodecRegistry createRegistry(final CodecRegistry codecRegistry, final UuidRepresentation uuidRepresentation) {
2727
CodecRegistry retVal = codecRegistry;
28-
if (uuidRepresentation != UuidRepresentation.JAVA_LEGACY) {
28+
if (uuidRepresentation != UuidRepresentation.UNSPECIFIED) {
2929
if (codecRegistry instanceof CodecProvider) {
3030
retVal = new OverridableUuidRepresentationCodecRegistry((CodecProvider) codecRegistry, uuidRepresentation);
3131
} else {

bson/src/test/unit/org/bson/LazyBSONObjectSpecification.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class LazyBSONObjectSpecification extends Specification {
7171
new Binary((byte) 0x01, (byte[]) [115, 116, 11]) | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 1, 115, 116, 11, 0]
7272
new Binary((byte) 0x03, (byte[]) [115, 116, 11]) | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 3, 115, 116, 11, 0]
7373
new Binary((byte) 0x04, (byte[]) [115, 116, 11]) | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 4, 115, 116, 11, 0]
74-
UUID.fromString('08070605-0403-0201-100f-0e0d0c0b0a09') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
75-
UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
7674
[13, 12] as byte[] | [15, 0, 0, 0, 5, 102, 0, 2, 0, 0, 0, 0, 13, 12, 0]
7775
[102, 111, 111] as byte[] | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 0, 102, 111, 111, 0]
7876
new ObjectId('50d3332018c6a1d8d1662b61') | [20, 0, 0, 0, 7, 102, 0, 80, -45, 51, 32, 24, -58, -95, -40, -47, 102, 43, 97, 0]

bson/src/test/unit/org/bson/codecs/DocumentCodecSpecification.groovy

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.bson.BsonUndefined
3030
import org.bson.BsonWriter
3131
import org.bson.ByteBufNIO
3232
import org.bson.Document
33+
import org.bson.codecs.configuration.CodecRegistry
3334
import org.bson.io.BasicOutputBuffer
3435
import org.bson.io.ByteBufferBsonInput
3536
import org.bson.json.JsonReader
@@ -57,8 +58,12 @@ import static org.bson.UuidRepresentation.STANDARD
5758
import static org.bson.UuidRepresentation.UNSPECIFIED
5859
import static org.bson.codecs.configuration.CodecRegistries.fromCodecs
5960
import static org.bson.codecs.configuration.CodecRegistries.fromProviders
61+
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries
6062

6163
class DocumentCodecSpecification extends Specification {
64+
static final CodecRegistry REGISTRY = fromRegistries(fromCodecs(new UuidCodec(STANDARD)),
65+
fromProviders(asList(new ValueCodecProvider(), new BsonValueCodecProvider(), new DocumentCodecProvider())))
66+
6267
@Shared
6368
BsonDocument bsonDoc = new BsonDocument()
6469
@Shared
@@ -97,7 +102,8 @@ class DocumentCodecSpecification extends Specification {
97102
}
98103

99104
when:
100-
new DocumentCodec().encode(writer, originalDocument, EncoderContext.builder().build())
105+
new DocumentCodec(REGISTRY).withUuidRepresentation(STANDARD)
106+
.encode(writer, originalDocument, EncoderContext.builder().build())
101107
BsonReader reader
102108
if (writer instanceof BsonDocumentWriter) {
103109
reader = new BsonDocumentReader(bsonDoc)
@@ -108,7 +114,7 @@ class DocumentCodecSpecification extends Specification {
108114
} else {
109115
reader = new JsonReader(stringWriter.toString())
110116
}
111-
def decodedDoc = new DocumentCodec().decode(reader, DecoderContext.builder().build())
117+
def decodedDoc = new DocumentCodec(REGISTRY).withUuidRepresentation(STANDARD).decode(reader, DecoderContext.builder().build())
112118

113119
then:
114120
decodedDoc.get('null') == originalDocument.get('null')
@@ -192,16 +198,17 @@ class DocumentCodecSpecification extends Specification {
192198
def reader = new BsonBinaryReader(ByteBuffer.wrap(bytes as byte[]))
193199

194200
when:
195-
def document = new DocumentCodec().withUuidRepresentation(representation)
201+
def document = new DocumentCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()))
202+
.withUuidRepresentation(representation)
196203
.decode(reader, DecoderContext.builder().build())
197204

198205
then:
199206
value == document.get('f')
200207

201208
where:
202-
representation | value | bytes
203-
STANDARD | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
204-
JAVA_LEGACY | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
209+
representation | value | bytes
210+
STANDARD | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
211+
JAVA_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
205212
C_SHARP_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
206213
PYTHON_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
207214
UNSPECIFIED | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]

bson/src/test/unit/org/bson/codecs/IterableCodecSpecification.groovy

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.bson.codecs
1818

19-
2019
import org.bson.BsonDocument
2120
import org.bson.BsonDocumentReader
2221
import org.bson.BsonDocumentWriter
@@ -32,11 +31,12 @@ import static org.bson.UuidRepresentation.STANDARD
3231
import static org.bson.UuidRepresentation.UNSPECIFIED
3332
import static org.bson.codecs.configuration.CodecRegistries.fromCodecs
3433
import static org.bson.codecs.configuration.CodecRegistries.fromProviders
34+
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries
3535

3636
class IterableCodecSpecification extends Specification {
3737

38-
static final REGISTRY = fromProviders(new ValueCodecProvider(), new DocumentCodecProvider(), new BsonValueCodecProvider(),
39-
new IterableCodecProvider())
38+
static final REGISTRY = fromRegistries(fromCodecs(new UuidCodec(JAVA_LEGACY)),
39+
fromProviders(new ValueCodecProvider(), new DocumentCodecProvider(), new BsonValueCodecProvider(), new IterableCodecProvider()))
4040

4141
def 'should have Iterable encoding class'() {
4242
given:
@@ -108,28 +108,6 @@ class IterableCodecSpecification extends Specification {
108108
iterable == ['1', '2', '3']
109109
}
110110

111-
def 'should decode binary subtypes for UUID'() {
112-
given:
113-
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)
114-
def reader = new BsonDocumentReader(parse(document))
115-
116-
when:
117-
reader.readStartDocument()
118-
reader.readName('array')
119-
def iterable = codec.decode(reader, DecoderContext.builder().build())
120-
reader.readEndDocument()
121-
122-
then:
123-
iterable == value
124-
125-
where:
126-
document | value
127-
'{"array": [{ "$binary" : "c3QL", "$type" : "3" }]}' | [new Binary((byte) 0x03, (byte[]) [115, 116, 11])]
128-
'{"array": [{ "$binary" : "c3QL", "$type" : "4" }]}' | [new Binary((byte) 0x04, (byte[]) [115, 116, 11])]
129-
'{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "3" }]}' | [UUID.fromString('08070605-0403-0201-100f-0e0d0c0b0a09')]
130-
'{"array": [{ "$binary" : "CAcGBQQDAgEQDw4NDAsKCQ==", "$type" : "3" }]}' | [UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10')]
131-
}
132-
133111
@SuppressWarnings(['LineLength'])
134112
@Unroll
135113
def 'should decode binary subtype 3 for UUID'() {
@@ -176,7 +154,7 @@ class IterableCodecSpecification extends Specification {
176154
where:
177155
representation | value | document
178156
STANDARD | [UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10')] | '{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "4" }]}'
179-
JAVA_LEGACY | [UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10')] | '{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "4" }]}'
157+
JAVA_LEGACY | [UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10')] | '{"array": [{ "$binary" : "CAcGBQQDAgEQDw4NDAsKCQ==", "$type" : "3" }]}'
180158
C_SHARP_LEGACY | [new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[])] | '{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "4" }]}'
181159
PYTHON_LEGACY | [new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[])] | '{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "4" }]}'
182160
UNSPECIFIED | [new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[])] | '{"array": [{ "$binary" : "AQIDBAUGBwgJCgsMDQ4PEA==", "$type" : "4" }]}'

bson/src/test/unit/org/bson/codecs/MapCodecSpecification.groovy

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ import static org.bson.UuidRepresentation.STANDARD
5757
import static org.bson.UuidRepresentation.UNSPECIFIED
5858
import static org.bson.codecs.configuration.CodecRegistries.fromCodecs
5959
import static org.bson.codecs.configuration.CodecRegistries.fromProviders
60+
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries
6061

6162
class MapCodecSpecification extends Specification {
63+
64+
static final REGISTRY = fromRegistries(fromCodecs(new UuidCodec(JAVA_LEGACY)),
65+
fromProviders(asList(new ValueCodecProvider(), new BsonValueCodecProvider(),
66+
new DocumentCodecProvider(), new IterableCodecProvider(), new MapCodecProvider())))
67+
6268
@Shared
6369
BsonDocument bsonDoc = new BsonDocument()
6470
@Shared
@@ -88,7 +94,6 @@ class MapCodecSpecification extends Specification {
8894
put('undefined', new BsonUndefined())
8995
put('binary', new Binary((byte) 0x80, [5, 4, 3, 2, 1] as byte[]))
9096
put('array', asList(1, 1L, true, [1, 2, 3], new Document('a', 1), null))
91-
put('uuid', new UUID(1L, 2L))
9297
put('document', new Document('a', 2))
9398
put('map', [a:1, b:2])
9499
put('atomicLong', new AtomicLong(1))
@@ -97,7 +102,7 @@ class MapCodecSpecification extends Specification {
97102
}
98103

99104
when:
100-
new MapCodec().encode(writer, originalDocument, EncoderContext.builder().build())
105+
new MapCodec(REGISTRY).encode(writer, originalDocument, EncoderContext.builder().build())
101106
BsonReader reader
102107
if (writer instanceof BsonDocumentWriter) {
103108
reader = new BsonDocumentReader(bsonDoc)
@@ -108,7 +113,7 @@ class MapCodecSpecification extends Specification {
108113
} else {
109114
reader = new JsonReader(stringWriter.toString())
110115
}
111-
def decodedDoc = new MapCodec().decode(reader, DecoderContext.builder().build())
116+
def decodedDoc = new MapCodec(REGISTRY).decode(reader, DecoderContext.builder().build())
112117

113118
then:
114119
decodedDoc.get('null') == originalDocument.get('null')
@@ -130,7 +135,6 @@ class MapCodecSpecification extends Specification {
130135
decodedDoc.get('timestamp') == originalDocument.get('timestamp')
131136
decodedDoc.get('undefined') == originalDocument.get('undefined')
132137
decodedDoc.get('binary') == originalDocument.get('binary')
133-
decodedDoc.get('uuid') == originalDocument.get('uuid')
134138
decodedDoc.get('array') == originalDocument.get('array')
135139
decodedDoc.get('document') == originalDocument.get('document')
136140
decodedDoc.get('map') == originalDocument.get('map')
@@ -145,6 +149,22 @@ class MapCodecSpecification extends Specification {
145149
]
146150
}
147151

152+
def 'should decode binary subtypes for UUID that are not 16 bytes into Binary'() {
153+
given:
154+
def reader = new BsonBinaryReader(ByteBuffer.wrap(bytes as byte[]))
155+
156+
when:
157+
def document = new DocumentCodec().decode(reader, DecoderContext.builder().build())
158+
159+
then:
160+
value == document.get('f')
161+
162+
where:
163+
value | bytes
164+
new Binary((byte) 0x03, (byte[]) [115, 116, 11]) | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 3, 115, 116, 11, 0]
165+
new Binary((byte) 0x04, (byte[]) [115, 116, 11]) | [16, 0, 0, 0, 5, 102, 0, 3, 0, 0, 0, 4, 115, 116, 11, 0]
166+
}
167+
148168
@SuppressWarnings(['LineLength'])
149169
@Unroll
150170
def 'should decode binary subtype 3 for UUID'() {
@@ -175,21 +195,23 @@ class MapCodecSpecification extends Specification {
175195
def reader = new BsonBinaryReader(ByteBuffer.wrap(bytes as byte[]))
176196

177197
when:
178-
def map = new MapCodec().withUuidRepresentation(representation)
198+
def map = new MapCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()))
199+
.withUuidRepresentation(representation)
179200
.decode(reader, DecoderContext.builder().build())
180201

181202
then:
182203
value == map.get('f')
183204

184205
where:
185-
representation | value | bytes
186-
STANDARD | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
187-
JAVA_LEGACY | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
206+
representation | value | bytes
207+
STANDARD | UUID.fromString('01020304-0506-0708-090a-0b0c0d0e0f10') | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
208+
JAVA_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
188209
C_SHARP_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
189210
PYTHON_LEGACY | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
190211
UNSPECIFIED | new Binary((byte) 4, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] as byte[]) | [29, 0, 0, 0, 5, 102, 0, 16, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0]
191212
}
192213

214+
193215
def 'should apply transformer to decoded values'() {
194216
given:
195217
def codec = new MapCodec(fromProviders([new ValueCodecProvider(), new DocumentCodecProvider(), new BsonValueCodecProvider()]),

0 commit comments

Comments
 (0)