How to use the faunadb.query.Collection function in faunadb

To help you get started, we’ve selected a few faunadb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Akryum / nodepack / packages / @nodepack / plugin-db-fauna / src / runtime / migration.js View on Github external
export async function writeMigrationRecords (ctx, data) {
  await ensureTable(ctx)
  const tableName = getTableName(ctx)
  await ctx.fauna.query(
    q.Update(q.Collection(tableName), {
      data,
    }),
  )
}
github Akryum / nodepack / packages / @nodepack / plugin-db-fauna / src / runtime / migration.js View on Github external
export async function readMigrationRecords (ctx) {
  await ensureTable(ctx)
  const { data } = await ctx.fauna.query(
    q.Get(q.Collection(getTableName(ctx))),
  )
  if (!data.files || !data.plugins) {
    return {
      files: [],
      plugins: [],
    }
  } else {
    return data
  }
}