mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-05-28 01:36:37 +00:00
docs: Show how to use database modules for db customization.
This commit is contained in:
parent
745af170c4
commit
208e9776e3
@ -2,20 +2,14 @@
|
||||
* @namespace Databases-Documents
|
||||
* @memberof module:Databases
|
||||
* @description Documents database.
|
||||
* @example <caption>Create documents db with default options</caption>
|
||||
* import { create } from 'IPFS'
|
||||
*
|
||||
* const ipfs = create()
|
||||
* const Partial = Documents()
|
||||
* const documents = await Partial({ ipfs })
|
||||
* @example <caption>Create documents db with custom index</caption>
|
||||
* import { create } from 'IPFS'
|
||||
* import { OrbitDB, Documents } from 'orbit-db'
|
||||
*
|
||||
* const ipfs = create()
|
||||
* const options = { indexBy: 'myCustomId'}
|
||||
* const Partial = Documents(options)
|
||||
* const documents = await Partial({ ipfs })
|
||||
*
|
||||
* const orbitdb = await OrbitDB({ ipfs })
|
||||
* const db = await orbitdb.open('my-docs', { Database: Documents({ indexBy: 'myCustomId'} ) }
|
||||
*
|
||||
* @augments module:Databases~Database
|
||||
*/
|
||||
import Database from '../database.js'
|
||||
|
@ -7,11 +7,12 @@
|
||||
* Key-value pairs are stored to the configured storage.
|
||||
* @example <caption>Specify a custom storage</caption>
|
||||
* import { create } from 'IPFS'
|
||||
* import { OrbitDB, KeyValueIndexed, IPFSBlockStorage } from 'orbit-db'
|
||||
*
|
||||
* const ipfs = create()
|
||||
* const storage = await IPFSBlockStorage()
|
||||
* const Partial = KeyValueIndexed({ storage })
|
||||
* const keyValueIndexed = await Partial({ ipfs })
|
||||
* const storage = await IPFSBlockStorage({ ipfs })
|
||||
* const orbitdb = await OrbitDB({ ipfs })
|
||||
* const db = await orbitdb.open('my-kv', { Database: KeyValueIndexed({ storage }) })
|
||||
*
|
||||
* @augments module:Databases~Database
|
||||
* @augments module:Databases.Databases-KeyValue
|
||||
|
Loading…
x
Reference in New Issue
Block a user