fauna/fauna-js

FQL Objects with nested queries

Lepozepo opened this issue · 2 comments

It feels like something like this should work with this driver but it currently does not:

const enhancer = { field1: fql`collection.all().paginate(n)` }
query(fql`Object.assign(someDocument, ${enhancer})`)

I'm getting an empty object for field1

This seems to be the same behavior with arrays as well, there may be some recursive resolver missing in the tagged template literal

Hi @Lepozepo thanks for the feedback! This pattern of query composition is something we want to support and is a work in progress.

We made some changes in the database itself to handle queries-within-literals-within-queries, but there is still some additional work needed to prevent some edge-case query injection issues.

We made these changes in the driver originally here: #214, but reverted it when we identified the issue.