[QUESTION] three-levels tree
See original GitHub issueHello!! I’m working with data structured in three levels
// all public and {get; set;}
class A {
int Id;
List<B> Bs;
}
class B {
int Id;
List<C> Cs;
}
class C {
int Id;
bool Happy;
}
BsonMapper.Global.Entity<C>().Id(x => x.Id, false);
BsonMapper.Global.Entity<B>().Id(x => x.Id, false).DbRef(x => x.Cs, "cs");
BsonMapper.Global.Entity<A>().Id(x => x.Id, false).DbRef(x => x.Bs, "bs");
db = new LiteDatabase($"Filename={dbPath};Password={password}", BsonMapper.Global);
a = new A {Id = 1};
b1 = new B {Id = 1};
b2 = new B {Id = 2};
c1 = new C {Id = 1};
c2 = new C {Id = 2};
c3 = new C {Id = 3};
a.Bs.Add(b1);
a.Bs.Add(b2);
b1.Cs.Add(c1);
b1.Cs.Add(c2);
b2.Cs.Add(c3);
var dba = db.GetCollection<A>().Add(a);
var res = dba.Include(x => x.Bs).FindAll().ToList();
Question 1: res will include all A and their children B… but how to include C too (they are contained in B.Cs) ? Question 2: if I use a configuration like Nodes and Archs, stored in 2 different collections, is it possible to investigate the graph in depth for n levels?
Thank you very much in advice 😉 bye!!!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Solved Q1) Consider a binary tree that has three levels
Question : Q1) Consider a binary tree that has three levels (height=depth=2). a. What is the maximum number of nodes in this tree?...
Read more >Top 50 Tree Coding Problems for Interviews
Problems in this Article are divided into three Levels so that readers can practice according to the difficulty level step by step.
Read more >Solved 1. Consider a binary tree that has three levels. a.
Question : 1. Consider a binary tree that has three levels. a. What is the maximum number of nodes in this tree? b....
Read more >Drill down and drill up in Tree map up to three levels
I am trying to apply drill down concept in Treemap up to 3 three levels. For an instance, I took superstore data and...
Read more >Tree testing 101 - Tree testing overview
Tree testing is a fast and powerful means to test the navigation tree of your website or app, or even test new tree...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dxmann Yes, you must manually insert all referenced documents.
It is possible to navigate through the documents, but you’ll need to use Bson Expressions. Here’s an example:
Ok, Thank you very much!! 😃