首页 > 解决方案 > 带有文档数组的 MongoDB 建模

问题描述

我正在尝试做这样的事情:

public class Model_Medication
{
    public ObjectId _id;

    public string name { set; get; }
    public List<Medication_Label> labels { set; get; }
}

public class Medication_Label
{
    public string ndc { set; get; }
    public string strength { set; get; }
    public ObjectId pill { set; get; }
}

我收到了这个错误:FormatException: Cannot deserialize a 'List<Medication_Label>' from BsonType 'Document'.

有什么建议或链接可以帮助我继续吗?

标签: c#.netmongodbdata-modeling

解决方案


推荐阅读