Sangria in Scala has a mechanism called &quot;Deferred&quot; that lets you specify that it should ask you to resolve objects of a certain type all at once at the end, and you would do a single SQL query per object type there.<p>If the JavaScript implementation doesn&#x27;t have something like this, perhaps it can be hacked on top.