Define a subquery for a Relation filter

WHAT DO YOU RECOMMEND?

Allow queries to filter based on properties of related objects.

HOW COULD IT BE DONE?

When making a query, a filter can be on a particular relation. That lets you pick a boolean operator and define a collection of related objects. It would be useful to be able to create a subquery for those matches (i.e. a query instead of a collection), instead of needing to pick a specific set.

REAL WORLD USE CASES

I’d like to query for all leaf nodes in a tree of tasks. Leaves would be any task that has no non-Done child tasks. That would allow me to focus on the requisites in sequence. This would be easy if a query could hide any tasks that have active subtasks.