Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Database

Hierarchy

  • Database

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Create a new local db instance.

    see

    for details on collection configuration options.

    Parameters

    • name: string

      The name for db persistence.

    • Rest ...collections: CollectionConfig[]

      A (variadic) list of collection configs.

    Returns Database

Properties

Readonly dexie

dexie: Dexie

Readonly remote

remote: Remote

Accessors

id

  • get id(): string | undefined
  • Base32-encoded string representation of the db's thread id.

    Returns string | undefined

verno

  • get verno(): number
  • Get the current local db version number. This is a non-ordered integer hash of the stringified input indexes. It is used for uniqueness.

    Returns number

Methods

close

  • close(): void
  • Close the local db to reads/writes.

    Returns void

collection

  • collection<T>(name: string): Collection<T> | undefined
  • Get an existing local collection.

    Type parameters

    • T = unknown

    Parameters

    • name: string

      The name of the collection.

    Returns Collection<T> | undefined

collectionConfig

  • Helper method to push additional collection configs to pending schemas list. This may be called multiple times, but must be called before opening the db.

    Parameters

    Returns this

collections

delete

  • delete(): Promise<void>
  • Delete the local db and its persistent storage.

    Returns Promise<void>

open

  • open(version?: number): Promise<this>
  • Open the local db for reads/writes.

    Parameters

    • Default value version: number = 1

    Returns Promise<this>