-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Codecs
-
None
-
Java Drivers
When querying data - I'd expect the collections codec registry to be used for the filters. However, with uuids this appears not to be the case.
// Test finding old UUIDs - insert data collection.insertOne(new Document("uuid", new BsonBinary(UUID.fromString("00000000-0000-0000-0000-000000000101"), UuidRepresentation.JAVA_LEGACY))); // Expected to not be found when using STANDARD representation Document uuidEncodedUsingLegacyJAVA = collection.find(eq("uuid", UUID.fromString("00000000-0000-0000-0000-000000000101"))).first(); System.out.println(" >>> " + uuidEncodedUsingLegacyJAVA); // Expected to find as have updated the codec registry, but does not!! uuidEncodedUsingLegacyJAVA = collection .withCodecRegistry(withUuidRepresentation(collection.getCodecRegistry(), UuidRepresentation.JAVA_LEGACY)) .find(eq("uuid", UUID.fromString("00000000-0000-0000-0000-000000000101"))).first(); System.out.println(" >>> " + uuidEncodedUsingLegacyJAVA); // Is found when manually setting the BsonBinary uuidEncodedUsingLegacyJAVA = collection.find(eq("uuid", new BsonBinary(UUID.fromString("00000000-0000-0000-0000-000000000101"), UuidRepresentation.JAVA_LEGACY))) .first(); System.out.println(" >>> " + uuidEncodedUsingLegacyJAVA);