the ER schema looks all right.
Bug 'db' and 'collect' handle additional arguments in a different way.
> : (db 'usr '+Pat *U 'doc *D)
This means: Find a '+Pat' object that has a '+Usr' as given in '*U', and
a '+Doc' as given in '*D'.
> : (collect 'usr '+Pat *U 'doc *D)
'collect' has a different syntax. Following 'usr' and '+Pat', it expects
a "from" and a "till" value (the "till" is optional), and then a chain
of 'get' arguments to retrieve subsequent values from the results.
For example (in the "app/" demo):
: (collect 'nr '+Item NIL T 'sup 'nm)
-> ("Active Parts Inc." "Seven Oaks Ltd." ...)
This collects all items (from NIL till T), then retrieves the supplier
from each item, and then the name from each supplier.
In your example, depending on what is in '*U' (the "till" value), it
tries to retrieve 'doc' from the results, and then that what is in '*D'.
What you probably intended was
: (filter '((This) (= *D (: doc))) (collect 'usr '+Pat *U))