I'm using MongoRepository and would like to create references between two different collections.
For example, A form could have a link to a form. It would be represented like:
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;}
}
I want to fetch the Form document with the Report nested like:
static MongoRepository<Form> forms = new MongoRepository<Form>();
var form = forms.Single(f => f.id == "1");
and the result look like:
{
"id": "1",
"Report": {
"id": "2"
}
}
Is this possible inside this framework? Is it possible just using the C# Driver base?
Don't know much about MongoRepository
but in the official driver you can:
MongoRepository
probably doesn't add much to this. It can only abstract that logic away from you...