Advanced querying - all TODOs from the pages that contains Parent Namespace "project"

hello Logseq community!
could you help me please with the query?

I am trying to query all TODOs from the pages with Parent Namespace “projects”, like “projects/building house” , “projects/learning spanish” , “projects/etc.”…

Is it possible?
I have been trying smtg like this but it is not working (and also there is no TODOs):

#+BEGIN_QUERY
{:title “FInd By Namespace”
:query [:find (pull ?b [*])
:where
[?p :block/namespace ?ns]
[?ns :block/name ?nsn]
[(contains? #{“projects”} ?nsn)]
[?b :block/page ?p]
(task ?b #{“TODO”})
]
}
#+END_QUERY (edited)

3 Likes