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

Guid serialization not standardized

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Dotnet Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      Guid is not represented the same when storing it in Dictionary<string, object>.

      If serializing Ienumerable<Guid> as dict, value, it's stored as UUID, but if serializing Guid, it's stored as binary.

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      2.24.0

      How to Reproduce

      Run the attached code.
      Store document with this line commented out
      BsonDefaults.GuidRepresentation = GuidRepresentation.Standard;

      Check all guids in the collection.

      Delete the document from the collection, uncoment mentioned line, and re run the code again.
      You will now notice all guids are stored as UUIDs, as opposed in the previous example.

      Additional Background

      No additional information at this point.

        1. source.cs
          1 kB
        2. image-2024-02-29-14-09-44-919.png
          image-2024-02-29-14-09-44-919.png
          131 kB
        3. image-2024-02-29-14-10-07-151.png
          image-2024-02-29-14-10-07-151.png
          119 kB
        4. image-2024-02-29-15-01-26-459.png
          image-2024-02-29-15-01-26-459.png
          69 kB

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            robiskaro@gmail.com Robert Skaro
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: