This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { query: q } = require('faunadb') | |
// fn-annotate | |
// https://www.npmjs.com/package/fn-annotate | |
const annotate = require('fn-annotate') | |
// converts a function into a faunaDB Let expression, but allows it to be used, | |
// as a regular function. This allows functions to be composed in JS land and | |
// turn out correctly in Fauna land. | |
const functionToLet = (fn) => (...args) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms)); | |
// or | |
// const baseQuery = q.Paginate(q.Collection(collectionName)) | |
const expandedQuery = q.Map(baseQuery, (ref) => | |
q.Let( | |
{ | |
instance: q.Get(q.Var('ref')) | |
}, | |
{ |