Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-3253

ToString in BsonDocument ignores subType and always shows the GUID with CSUUID subType even though the value in UUID

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: Public
    • Labels:
      None

      Description

      It's really visible here in debugging: https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver/Encryption/ExplicitEncryptionLibMongoCryptController.cs#L59 where wrappedKeyDocument shows that _id is in CSUUID form. But if we check the _id value itself, it will be in UUID format.

      Simplified test is:

                  var @string = $"{{ '_id' : UUID('3fdabe71-f829-4469-9c5c-15cc4881c50c') }}";
                  var bsonDocument = BsonDocument.Parse(@string);
                  var stringDocument = bsonDocument.ToString();
                  stringDocument.Should().Contain("CSUUID"); // pass
                  stringDocument.Should().NotContain("3fdabe71-f829-4469-9c5c-15cc4881c50c"); // fail, pay attention that guid numbers are the same in both places
      

      NOTE: bytes in both cases are the same, the only difference is subType

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dmitry.lukyanov Dmitry Lukyanov
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: