Ramya Devendiran
06/04/2024, 8:48 AMrickbutterfield
06/04/2024, 9:09 AMDescendants
query is going to be expensive to run (see https://docs.umbraco.com/umbraco-cms/reference/common-pitfalls#querying-with-descendants-descendantsorself) so I would consider rewriting it something like this... (may not be 100% correct!)
csharp
// Get 'Home'
var rootNode = Umbraco.ContentAtRoot().FirstOrDefault(x => x.IsDocumentType(Home.ModelTypeAlias);
// Get first 'Doc1' type
var doc1Node = rootNode?.FirstOrDefault(x => x.IsDocumentType(doc1.ModelTypeAlias);
// Get all 'Doc2' children
var doc2Node = doc1Node?.Children<doc2>();
That removes the descendant query which can traverse the whole tree and only searches the next level down each timekdx-perbol
06/04/2024, 9:29 AMMatt Wise
06/04/2024, 9:36 AMRamya Devendiran
06/04/2024, 12:59 PMMatt Wise
06/04/2024, 1:09 PMMatt Wise
06/04/2024, 1:09 PM