Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3378

UUIDCodec default UuidRepresentation should be STANDARD

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: BSON
    • Labels:
      None
    • Environment:
      Windows 10

      Description

      According to documentation, since version 3.0 the default UUID representation is the `STANDARD` one.

      Except for `UuidCodec` default constructor uses `JAVA_LEGACY` representation, making applications still store `LUUID` by default.

      It is interesting to note that `ValueCodecProvider`, which is the default codec provider uses the default constructor for `UuidCodec`, making sure that `JAVA_LEGACY`/`LUUID` type is used by default.

      I think the default constructor can be changed to `STANDARD` representation, as stated in documentation, and even in code:

      // changed the default subtype to STANDARD since 3.0
      if (encoderUuidRepresentation == UuidRepresentation.STANDARD) {
       writer.writeBinaryData(new BsonBinary(BsonBinarySubType.UUID_STANDARD, binaryData));
      } else {
       writer.writeBinaryData(new BsonBinary(BsonBinarySubType.UUID_LEGACY, binaryData));
      }
      

      Environment variables could be used to restore legacy behaviour withour resorting to mess with code.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jeff.yemin Jeffrey Yemin
              Reporter:
              gmcouto@gmail.com Gabriel Couto
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: