Base class for bridge stores.

Hierarchy

Constructors

Properties

db: Nedb<any>

Methods

  • Convenience method to convert a document to something.

    Returns

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

    Type Parameters

    • T

    • O

    Parameters

    • func: ((input: T) => O)

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

        • (input: T): O
        • Parameters

          • input: T

          Returns O

    Returns ((doc: T) => O)

      • (doc: T): O
      • Parameters

        • doc: T

        Returns O

  • DELETE multiple documents.

    Parameters

    • query: Query

    Returns Promise<number>

  • INSERT a multiple documents.

    Parameters

    • objects: unknown

    Returns Promise<any[]>

  • 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: T) => O)
        • (input: T): O
        • Parameters

          • input: T

          Returns O

    Returns Promise<O[]>

  • SELECT a single document.

    Type Parameters

    • T

    • O

    Parameters

    • query: Query
    • Optional transformFn: ((input: T) => O)
        • (input: T): 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

  • Parameters

    Returns Promise<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