Right. As I explained above, $hfind() is going to be horrendously slow, so you will have to design your table accordingly to predict how you will access the data and to make sure that it can be queried directly without performing iterative searches. This means lots of cross indexing, reverse indexing, sideways indexing... that is, performing multiple /hadd's to cover all of your bases of lookup direction.

If you want the list "adam bobby charlie" then you will need to create that list.

Code
var %user = charlie
var %users = $hget(%table,root.users)
var %users = $addtok(%users,%user,32)  [addtok prevents adding duplicate items to a list]
hadd %table root.users %users
var %item = baz
var %useritems = $hget(%table,root.users. $+ %user $+ .items)
var %useritems = $addtok(%useritems,%item,32)
hadd %table root.users. $+ %user $+ .items %useritems
hadd %table root.user. $+ %user $+ . $+ %item I'm a little teapot.

; [table]
; root.users == adam bobby charlie
; root.users.adam.foo == Did you miss me?
; root.users.bobby.bar == Not that it matters!
; root.users.charlie.baz == I'm a little teapot.
; root.users.adam.items == foo
; root.users.bobby.items == bar
; root.users.charlie.items == baz

Last edited by Raccoon; 18/10/19 09:35 AM.

Well. At least I won lunch.
Good philosophy, see good in bad, I like!