arthur_
7 years agoGuide
Select direct child nodes
Hi, I am trying to select all direct child nodes relative to the current position in hierarchy (using coreNode.id) in CategoryPage with the following query: SELECT * FROM nodes WHERE ances...
- 7 years ago
arthur_- You can use depth with your current query, You just need to know the current coreNode depth e.g your core node depth is 1, you can pass depth 2 in your query.
SELECT title FROM nodes WHERE ancestors.id ='category:${coreNode.id}' AND depth = 2
- 7 years ago
arthur_- Below is the more exact query, you can use parent.id to get the exact result.
SELECT * FROM nodes WHERE parent.id = 'category:${coreNode.id}' ORDER BY position ASC
The parent.id always fetch the one level down nodes.
Here is the documentation https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=nodes#constraints-parent.id