Support Span based binary writes on the bson writer

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Unknown
    • None
    • Affects Version/s: 3.0.0
    • Component/s: None
    • None
    • 🔵 Done
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      IBsonWriter doesn't accept writing ReadOnlySpan<byte> or ReadOnlyMemory<byte> and always requires a full byte array. This means that even though the driver supports declaring properties as ReadOnlyMemory<byte> the underlying serializer will eventually have to call bytes.ToArray() to copy the ROM.

      I went down the path of exploring the change set and was thinking to do a community contribution but I realized it requires a few public type changes which might quickly become out of scope for a community contribution.

      See https://github.com/danielmarbach/mongo-csharp-driver/commit/f3e96f2be1ff201456f7388522a5dc5736c85efb

            Assignee:
            Boris Dogadov
            Reporter:
            Daniel Marbach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: