Module: Databases

Provides various database structures for storing data.

Source:

Namespaces

Databases-Documents
Databases-Events
Databases-KeyValue
Databases-KeyValueIndexed
Database

Members

(static) databaseTypes

An array of available database types.

Source:

Methods

(static) Documents(options) → {module:Databases.Databases-Documents}

Defines a Documents database.

Parameters:
Name Type Description
options Object

Various options for configuring the Document store.

Properties
Name Type Attributes Default Description
indexBy string <optional>
_id

An index.

Source:
Returns:

A Documents function.

Type
module:Databases.Databases-Documents

(static) Events() → {module:Databases.Databases-Events}

Defines an Events database.

Source:
Returns:

A Events function.

Type
module:Databases.Databases-Events

(static) KeyValue() → {module:Databases.Databases-KeyValue}

Defines a KeyValue database.

Source:
Returns:

A KeyValue function.

Type
module:Databases.Databases-KeyValue

(static) KeyValueIndexed(storageopt) → {module:Databases.Databases-KeyValueIndexed}

Defines a KeyValueIndexed database.

Parameters:
Name Type Attributes Default Description
storage module:Storage <optional>
LevelStorage

A compatible storage where the key/value pairs are indexed.

Source:
Returns:

A KeyValueIndexed function.

Type
module:Databases.Databases-KeyValueIndexed

(static) useDatabaseType(database)

Add a new database type.

Parameters:
Name Type Description
database module:Databases

A Database-compatible module.

Source:
Throws:
  • Database type does not contain required field 'type'.

  • Database type '$' already added.

    Type
    store.type
Example
import { useDatabaseType } from 'orbitdb'
const CustomDBTypeModule = async (params) => {
  const database = await Database(...params)
  ...
}
useDatabaseType(CustomDBTypeModule)