mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-05-30 10:46:36 +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
|
* @namespace Databases-Documents
|
||||||
* @memberof module:Databases
|
* @memberof module:Databases
|
||||||
* @description Documents database.
|
* @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>
|
* @example <caption>Create documents db with custom index</caption>
|
||||||
* import { create } from 'IPFS'
|
* import { create } from 'IPFS'
|
||||||
|
* import { OrbitDB, Documents } from 'orbit-db'
|
||||||
*
|
*
|
||||||
* const ipfs = create()
|
* const ipfs = create()
|
||||||
* const options = { indexBy: 'myCustomId'}
|
* const orbitdb = await OrbitDB({ ipfs })
|
||||||
* const Partial = Documents(options)
|
* const db = await orbitdb.open('my-docs', { Database: Documents({ indexBy: 'myCustomId'} ) }
|
||||||
* const documents = await Partial({ ipfs })
|
*
|
||||||
*
|
|
||||||
* @augments module:Databases~Database
|
* @augments module:Databases~Database
|
||||||
*/
|
*/
|
||||||
import Database from '../database.js'
|
import Database from '../database.js'
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
* Key-value pairs are stored to the configured storage.
|
* Key-value pairs are stored to the configured storage.
|
||||||
* @example <caption>Specify a custom storage</caption>
|
* @example <caption>Specify a custom storage</caption>
|
||||||
* import { create } from 'IPFS'
|
* import { create } from 'IPFS'
|
||||||
|
* import { OrbitDB, KeyValueIndexed, IPFSBlockStorage } from 'orbit-db'
|
||||||
*
|
*
|
||||||
* const ipfs = create()
|
* const ipfs = create()
|
||||||
* const storage = await IPFSBlockStorage()
|
* const storage = await IPFSBlockStorage({ ipfs })
|
||||||
* const Partial = KeyValueIndexed({ storage })
|
* const orbitdb = await OrbitDB({ ipfs })
|
||||||
* const keyValueIndexed = await Partial({ ipfs })
|
* const db = await orbitdb.open('my-kv', { Database: KeyValueIndexed({ storage }) })
|
||||||
*
|
*
|
||||||
* @augments module:Databases~Database
|
* @augments module:Databases~Database
|
||||||
* @augments module:Databases.Databases-KeyValue
|
* @augments module:Databases.Databases-KeyValue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user