Suppose class Menu use property ICollection<Menu> Items { get ; set ; } . It is representing data field in mongodb . When insert data and show it will have the following structure:
I want loop from N1 to N1-child1,child2,child3,.... (done).
How to when N1 and its children are finished. Looping back to N2 , N3 .
Here is my json code according to mongodb structure:
I want to get the Id of branches N1 , N2 , N3 equivalent to Object1 and Object2 to compare with the passed ID parameter , if it matches , then stop the recursion



It's super simple. This is all you need: