The instance returned by module:OrbitDB.
- Source:
Methods
(async) open(address, params) → {module:Database}
Open a database or create one if it does not already exist.
By default, OrbitDB will create a database of type DefaultDatabaseType:
const mydb = await orbitdb.open('mydb')
To create a database of a different type, specify the type param:
const mydb = await orbitdb.open('mydb', {type: 'documents'})
The type must be listed in databaseTypes or an error is thrown.
To open an existing database, pass its address to the open
function:
const existingDB = await orbitdb.open(dbAddress)
The address of a newly created database can be retrieved using
db.address
.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
address |
string | The address of an existing database to open, or the name of a new database. |
||||||||||||||||||||||||||||||||||||||||||||||||||
params |
Object | One or more database configuration parameters. Properties
|
- Source:
Throws:
"Unsupported database type" if the type specified is not in the list of known databaseTypes.
Returns:
A database instance.
- Type
- module:Database
(async) stop()
Stops OrbitDB, closing the underlying keystore and manifest store.
- Source: