Details
-
Improvement
-
Resolution: Unresolved
-
Unknown
-
None
-
2.21.0
-
None
Description
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.
We would like to support this option when using the `BsonClassMapSerializer`. This feature requires changes to the `BsonClassMapSerializer`, as well as adding code and attribute based ways to configure this.
Attachments
Issue Links
- is related to
-
CSHARP-4757 Modify BsonSerializationInfo to handle properties that are grouped in a nested document
-
- Closed
-