prorm API Reference
    Preparing search index...

    Class FaunaDbStore

    Base interface for NoSQL stores.

    NoSQL engines (document stores, key-value caches, partition-key stores) do not share the SQL-shaped Dialect interface (no query(sql), no identifier escaping, no DDL). NoSqlStore is intentionally minimal: connection lifecycle plus a raw escape hatch. Each store's real API surface (find/insert/update for Mongo, hash/list/set ops for Redis, item CRUD for DynamoDB) lives on its own class, not on this interface, because forcing them into one shared query shape would misrepresent what each engine can actually do.

    Implements

    Index
    name: "faunadb" = 'faunadb'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "faunadb" = 'faunadb'

    The client library being used

    • Create a document in collection; returns the new document's id.

      Parameters

      • collection: string
      • doc: Record<string, unknown>

      Returns Promise<unknown>

    • Fetch a document by id, returning its data.

      Parameters

      • collection: string
      • id: string

      Returns Promise<unknown>

    • Merge patch into a document's data, returning the updated data.

      Parameters

      • collection: string
      • id: string
      • patch: Record<string, unknown>

      Returns Promise<unknown>

    • Delete a document by id.

      Parameters

      • collection: string
      • id: string

      Returns Promise<unknown>

    • Run an FQL query. When expr is provided it is executed directly; otherwise all documents in collection are paginated and dereferenced. Returns the query's data array.

      Parameters

      • collection: string
      • Optionalexpr: unknown

      Returns Promise<unknown[]>

    • Fetch every document in collection matching the ORM where clause. The where is compiled to an FQL predicate applied via Filter over the collection's documents; order/limit/offset are applied client-side. Each result is normalized to its data fields plus an id.

      This scans the collection (bounded by pageSize). For large collections, define a Fauna index and use the raw query escape hatch for an index-driven read.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • collection: string
      • options: FaunaFindOptions = {}

      Returns Promise<T[]>

    • Fetch the first document matching where (client-side limit 1), or null.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • collection: string
      • options: FaunaFindOptions = {}

      Returns Promise<T | null>

    • Count documents in collection matching where.

      Parameters

      • collection: string
      • Optionalwhere: Record<string, any>

      Returns Promise<number>

    • Insert data and return the new document's id. Alias of insert.

      Parameters

      • collection: string
      • data: Record<string, unknown>

      Returns Promise<unknown>

    • Insert many documents atomically in a single FQL Map/Create, returning the new document ids in order.

      Parameters

      • collection: string
      • docs: Record<string, unknown>[]

      Returns Promise<unknown[]>

    • Update every document matching where, merging values into each match's data, all in a single atomic FQL expression. Returns the number of documents updated.

      Parameters

      • collection: string
      • values: Record<string, unknown>
      • Optionalwhere: Record<string, any>

      Returns Promise<number>

    • Delete every document matching where in a single atomic FQL expression. Returns the number of documents deleted.

      Parameters

      • collection: string
      • Optionalwhere: Record<string, any>

      Returns Promise<number>

    • Insert-or-update: if a document matching where exists, merge data into the first match; otherwise create a new document seeded with the where equality keys plus data. Returns { created }.

      Parameters

      • collection: string
      • data: Record<string, unknown>
      • where: Record<string, any>

      Returns Promise<{ created: boolean }>

    • Run several FQL write expressions atomically in a single transaction via FQL's Do (Fauna evaluates a single query as one serializable transaction). Pass expressions built with the query builder from getQuery. Returns the value of the last expression.

      Parameters

      • expressions: unknown[]

      Returns Promise<unknown>

    • Exposes the FQL query builder (faunadb.query) for building raw expressions.

      Returns any