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

Modify BsonSerializationInfo to handle properties that are grouped in a nested document

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 2.22.0
    • Affects Version/s: 2.21.0
    • Component/s: LINQ3
    • None
    • Not Needed
    • 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?

      In some cases it can be advantageous to group several properties under a nested document in the serialized form.

      For example, the class:

      public class OrderItem
      {
          public int OrderId { get; set; }
          public int ProductId { get; set; }
          public int Quantity { get; set; }
      }

      might need to be serialized as:

      {
          _id :
          {
              OrderId : 1,
              ProductId : 2
          },
          Quantity : 3
      }

      While this serialization format could also be achieved by declaring a custom POCO to hold the OrderId/ProductId pair, there are cases where we might want the components of a compound primary key to appear at the top level in the POCO while being grouped together in a nested `_id` element in the serialized form.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: