I am trying to do a nested lookup to go down N Levels using the C# MongoDb Client.
I have these Class
class User {
public string Id {get;set;}
public string Name {get;set;}
}
class Category {
public string Id {get;set;}
public string Name {get;set;}
public string UserId {get;set;}
}
class Product {
public string Id {get;set;}
public string Name {get;set;}
public string CategoryId {get;set;}
}
Now I can do a normal LookUp very easily and even N Lookups using the details provide on this Link
Here are my joined Classed for Fetching:
class UserJoined : User {
public ICollection<Category> Categories {get;set;}
}
class CategoryJoined : Category {
public ICollection<Product> Products {get;set;}
}
But I want to do nested.
I was thinking of this Approach by adding a new field in the User to go nested
class UserJoined : User {
public ICollection<Category> Categories {get;set;}
public ICollection<CategoryJoined> CategoryJoins {get;set;}
}
But I don't know the syntax to go nested in C# MongoDb.