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

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Unassigned
            Reporter:
            Dmitry Lukyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: