belongs-to as nested map in results

5 views
Skip to first unread message

Răzvan Rotaru

unread,
Aug 6, 2017, 1:52:15 PM8/6/17
to Korma
Hi,

I know this question has been asked before, but this was some time ago plus I haven't found an acceptable answer in the old posts. So here I go:

Assuming I have a "belongs-to" relationship, how can I select the related entity, and have the result as a nested data structure.

Example:

(defentity department)

(defentity employee
   
(belongs-to department))

(select employee (with department))



Expected result:

{
   
:id 10
   
:name "John Smith"
   
:department {
       
:name "Customer Support"
       
:id 500
   
}
}

Thanks,
Razvan

Reply all
Reply to author
Forward
0 new messages