Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from orbitdb/v1.5.0
Browse files Browse the repository at this point in the history
V1.5.0
  • Loading branch information
shamb0t authored May 3, 2019
2 parents b8bca44 + 1961f85 commit 1fd742f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Database for storing indexed documents. Stores documents by `_id` field by default but you can also specify a custom field to index by.

*This is a core data store in [orbit-db](https://github.com/haadcode/orbit-db)*
*This is a core data store in [orbit-db](https://github.com/orbitdb/orbit-db)*

## Table of Contents

Expand All @@ -32,8 +32,8 @@ const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')

const ipfs = new IPFS()
const orbitdb = new OrbitDB(ipfs)
const docstore = orbitdb.docstore('db name')
const orbitdb = await OrbitDB.createInstance(ipfs)
const docstore = await orbitdb.docstore('db name')

docstore.put({ _id: 'hello world', doc: 'all the things' })
.then(() => docstore.put({ _id: 'sup world', doc: 'other things' }))
Expand All @@ -46,7 +46,7 @@ docstore.put({ _id: 'hello world', doc: 'all the things' })
You can specify the field to index by in the options:

```javascript
const docstore = orbitdb.docstore('db name', { indexBy: 'doc' })
const docstore = await orbitdb.docstore('db name', { indexBy: 'doc' })

docstore.put({ _id: 'hello world', doc: 'some things' })
.then(() => docstore.put({ _id: 'hello universe', doc: 'all the things' }))
Expand All @@ -59,7 +59,7 @@ docstore.put({ _id: 'hello world', doc: 'some things' })
You can also use a mapper to query the documents

```javascript
const docstore = orbitdb.docstore('db name')
const docstore = await orbitdb.docstore('db name')

docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
.then(() => docstore.put({ _id: 'hello universe', doc: 'all the things', views: 100 }))
Expand All @@ -71,21 +71,21 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })

## API

*See [orbit-db API documentation](https://github.com/haadcode/orbit-db/blob/master/API.md) for full details*
*See [orbit-db API documentation](https://github.com/orbitdb/orbit-db/blob/master/API.md) for full details*

### docstore(name, options)

Package:
[orbit-db-docstore](https://github.com/shamb0t/orbit-db-docstore)
[orbit-db-docstore](https://github.com/orbitdb/orbit-db-docstore)

```javascript
const db = orbitdb.docstore('orbit.users.shamb0t.profile')
const db = await orbitdb.docstore('orbit.users.shamb0t.profile')
```

By default, documents are indexed by field '_id'. You can also specify the field to index by:

```javascript
const db = orbitdb.docstore('orbit.users.shamb0t.profile', { indexBy: 'name' })
const db = await orbitdb.docstore('orbit.users.shamb0t.profile', { indexBy: 'name' })
```

- **put(doc)**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orbit-db-docstore",
"version": "1.5.1-rc3",
"version": "1.5.0",
"description": "Document Store for orbit-db",
"main": "src/DocumentStore.js",
"scripts": {
Expand All @@ -14,7 +14,7 @@
"author": "shamb0t",
"license": "MIT",
"dependencies": {
"orbit-db-store": "next",
"orbit-db-store": "~2.6.0",
"p-map": "~1.1.1"
},
"devDependencies": {},
Expand Down

0 comments on commit 1fd742f

Please sign in to comment.