如何序列化MongoDB文档的第一个属性?

时间:2018-04-06 15:27:26

标签: c# mongodb serialization bson

我有以下MongoDB文件"标识"具有可变属性。

1 -

"identifications" : {
                    "a" : {
                            "type" : "a",
                            "value" : "x1"
                    }
            }

2 -

 "identifications" : {
                    "a" : {
                            "type" : "a",
                            "value" : "x2"
                    }
            }

3 -

 "identifications" : {
                    "b" : {
                            "type" : "b",
                            "value" : "x3"
                    }
              }

4 -

    "identifications" : {
                    "c" : {
                            "type" : "c",
                            "value" : "x4"
                    }
              }

我想在BSONType中为C#Driver序列化标识文档。我的想法是

public class Identifications
{
    [BsonElement(Order = 1)]
    public Property prop { get; set; }
}

但它返回一个空值。无论其名称如何,都有一些东西需要它?

0 个答案:

没有答案