Base class for bridge stores.

Hierarchy (view full)

Constructors

Properties

db: Nedb<any>

Methods

  • Convenience method to convert a document to something.

    Type Parameters

    • T

    • O

    Parameters

    • func: ((input) => O)

      The function which will be called with a single document object. Guaranteed not to be null.

        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns ((doc) => O)

    A transformFn function to pass to the standard select/delete/upsert/etc methods.

      • (doc): O
      • Parameters

        • doc: T

        Returns O

  • INSERT IF NOT EXISTS a single document

    Parameters

    • query: Query
    • insertObj: Record<string, unknown>

    Returns Promise<void>

  • SELECT a number of documents.

    Type Parameters

    • T

    • O

    Parameters

    • query: Query
    • Optional transformFn: ((input) => O)
        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns Promise<O[]>

  • SELECT a single document.

    Type Parameters

    • T

    • O

    Parameters

    • query: Query
    • Optional transformFn: ((input) => O)
        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns Promise<null | O>

  • Set a UNIQUE key constraint on the given field.

    Parameters

    • fieldName: string

      The field name. Use dot notation for nested objects.

    • sparse: boolean = false

      Allow sparse entries (undefined won't cause a key violation).

    Returns void

  • UPDATE a single document. If the document already exists, this will NOT update it.

    Parameters

    • query: Query
    • updateVals: Record<string, unknown>

    Returns Promise<void>

  • UPSERT a single document

    Type Parameters

    • T

    Parameters

    • query: Query
    • updateVals: T

    Returns Promise<void>

Generated using TypeDoc