【发布时间】:2023-01-01 23:32:51
【问题描述】:
有什么方法可以将对象的 Mongo 数组映射到 C# 字典。 比如我有一个文档:
{
"_id": ...,
"customerId": ...,
"items": [
{
"productId": ...,
"productTitle": ...,
"unitPrice": ...,
"quantity": ...,
"discount": ...
}
]
}
我想将“项目”映射到一个字典,其中键是“productId”,值是整个对象
做这个的最好方式是什么?
【问题讨论】:
标签: c# mongodb mongodb-.net-driver