How do I query nested data structures in XTQL? e.g. if I have a structure like:
{:xt/id 1
:foo {:bar "abc"}}
how would I query for 'objects with attribute :foo that contain :bar = "abc"'?you can access a nested field using Clojure's dot syntax - (. foo bar)
so something like
(unify (from :my-table [foo])
(where (= "abc" (. foo bar))))
Hm, this doesn't seem to work with namespaced fields. If I have a doc
{:xt/id 1 :foo/a {:baz/b "bar"}}
and I try to query it with
(unify (from :docs [xt/id foo/a])
(where (= (. foo/a baz/b) "bar")))
it returns no results [https://play.xtdb.com/?version=2.0.0-b1&type=xtql&txs=W3sic3lzdGVtLXRpbWUiOm51bGwsInR4cyI6Ils6cHV0LWRvY3MgOmRvY3Mgezp4dC9pZCAxIDpmb28vYSB7OmJhei9iIFwiYmFyXCJ9fV0ifV0%3D&query=KHVuaWZ5IChmcm9tIDpkb2NzIFt4dC9pZCBmb28vYV0pCiAgKHdoZXJlICg9ICguIGZvby9hIGJhei9iKSAiYmFyIikpKQ%3D%3D]thanks @esp1 - that one sounds like a bug 😞 would you be able to raise an issue?