1

私はMongoRepositoryを使用しており、2 つの異なるコレクション間の参照を作成したいと考えています。

たとえば、フォームにフォームへのリンクを含めることができます。次のように表されます。

public class Form : IEntity{
     public string Id {get;set;}
     public string Report {get;set;} // represents the string form of the ObjectId
}

public class Report : IEntity{
     public string Id {get;set;}
}

Report が次のようにネストされた Form ドキュメントを取得したい:

static MongoRepository<Form> forms = new MongoRepository<Form>();
var form = forms.Single(f => f.id == "1");

結果は次のようになります。

{
    "id": "1",
    "Report": {
        "id": "2"
    }
}

これはこのフレームワーク内で可能ですか? C# ドライバー ベースだけを使用することは可能ですか?

4

1 に答える 1