77
88Database for storing indexed documents. Stores documents by ` _id ` field by default but you can also specify a custom field to index by.
99
10- * This is a core data store in [ orbit-db] ( https://github.com/haadcode /orbit-db ) *
10+ * This is a core data store in [ orbit-db] ( https://github.com/orbitdb /orbit-db ) *
1111
1212## Table of Contents
1313
@@ -32,8 +32,8 @@ const IPFS = require('ipfs')
3232const OrbitDB = require (' orbit-db' )
3333
3434const ipfs = new IPFS ()
35- const orbitdb = new OrbitDB (ipfs)
36- const docstore = orbitdb .docstore (' db name' )
35+ const orbitdb = await OrbitDB . createInstance (ipfs)
36+ const docstore = await orbitdb .docstore (' db name' )
3737
3838docstore .put ({ _id: ' hello world' , doc: ' all the things' })
3939 .then (() => docstore .put ({ _id: ' sup world' , doc: ' other things' }))
@@ -46,7 +46,7 @@ docstore.put({ _id: 'hello world', doc: 'all the things' })
4646You can specify the field to index by in the options:
4747
4848``` javascript
49- const docstore = orbitdb .docstore (' db name' , { indexBy: ' doc' })
49+ const docstore = await orbitdb .docstore (' db name' , { indexBy: ' doc' })
5050
5151docstore .put ({ _id: ' hello world' , doc: ' some things' })
5252 .then (() => docstore .put ({ _id: ' hello universe' , doc: ' all the things' }))
@@ -59,7 +59,7 @@ docstore.put({ _id: 'hello world', doc: 'some things' })
5959You can also use a mapper to query the documents
6060
6161``` javascript
62- const docstore = orbitdb .docstore (' db name' )
62+ const docstore = await orbitdb .docstore (' db name' )
6363
6464docstore .put ({ _id: ' hello world' , doc: ' some things' , views: 10 })
6565 .then (() => docstore .put ({ _id: ' hello universe' , doc: ' all the things' , views: 100 }))
@@ -71,21 +71,21 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
7171
7272## API
7373
74- * See [ orbit-db API documentation] ( https://github.com/haadcode /orbit-db/blob/master/API.md ) for full details*
74+ * See [ orbit-db API documentation] ( https://github.com/orbitdb /orbit-db/blob/master/API.md ) for full details*
7575
7676### docstore(name, options)
7777
7878 Package:
79- [ orbit-db-docstore] ( https://github.com/shamb0t /orbit-db-docstore )
79+ [ orbit-db-docstore] ( https://github.com/orbitdb /orbit-db-docstore )
8080
8181 ``` javascript
82- const db = orbitdb .docstore (' orbit.users.shamb0t.profile' )
82+ const db = await orbitdb .docstore (' orbit.users.shamb0t.profile' )
8383 ```
8484
8585 By default, documents are indexed by field '_ id'. You can also specify the field to index by:
8686
8787 ``` javascript
88- const db = orbitdb .docstore (' orbit.users.shamb0t.profile' , { indexBy: ' name' })
88+ const db = await orbitdb .docstore (' orbit.users.shamb0t.profile' , { indexBy: ' name' })
8989 ```
9090
9191 - ** put(doc)**
0 commit comments