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

Commit c4b5b15

Browse files
committed
Update community documentation
1 parent c9e7bb4 commit c4b5b15

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
# orbit-db-docstore
22

3+
[![npm](https://img.shields.io/npm/v/orbit-db-docstore.svg)](https://www.npmjs.com/package/orbit-db-docstore)
4+
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/orbitdb/Lobby)
5+
36
> Document Store for orbit-db
47
58
Database for storing indexed documents. Stores documents by `_id` field by default but you can also specify a custom field to index by.
69

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

12+
## Table of Contents
13+
14+
- [Install](#install)
15+
- [Usage](#usage)
16+
- [API](#api)
17+
- [docstore(name, options)](#docstorename-options)
18+
- [License](#license)
19+
920
## Install
1021

22+
This project uses [npm](https://npmjs.com) and [nodejs](https://nodejs.org)
23+
1124
```
1225
npm install orbit-db-docstore
1326
```
@@ -25,7 +38,7 @@ const docstore = orbitdb.docstore('db name')
2538
docstore.put({ _id: 'hello world', doc: 'all the things' })
2639
.then(() => docstore.put({ _id: 'sup world', doc: 'other things' }))
2740
.then(() => docstore.get('hello'))
28-
.then((value) => console.log(value))
41+
.then((value) => console.log(value))
2942
// [{ _id: 'hello world', doc: 'all the things'}]
3043

3144
```
@@ -38,7 +51,7 @@ const docstore = orbitdb.docstore('db name', { indexBy: 'doc' })
3851
docstore.put({ _id: 'hello world', doc: 'some things' })
3952
.then(() => docstore.put({ _id: 'hello universe', doc: 'all the things' }))
4053
.then(() => docstore.get('all'))
41-
.then((value) => console.log(value))
54+
.then((value) => console.log(value))
4255
// [{ _id: 'hello universe', doc: 'all the things'}]
4356

4457
```
@@ -52,7 +65,7 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
5265
.then(() => docstore.put({ _id: 'hello universe', doc: 'all the things', views: 100 }))
5366
.then(() => docstore.put({ _id: 'sup world', doc: 'other things', views: 5 }))
5467
.then(() => docstore.query((e)=> e.views > 5))
55-
.then((value) => console.log(value))
68+
.then((value) => console.log(value))
5669
// [{ _id: 'hello world', doc: 'some things', views: 10}, { _id: 'hello universe', doc: 'all the things', views: 100}]
5770
```
5871

@@ -62,7 +75,7 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
6275

6376
### docstore(name, options)
6477

65-
Package:
78+
Package:
6679
[orbit-db-docstore](https://github.com/shamb0t/orbit-db-docstore)
6780

6881
```javascript
@@ -79,14 +92,14 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
7992
```javascript
8093
db.put({ _id: 'QmAwesomeIpfsHash', name: 'shamb0t', followers: 500 }).then((hash) => ...)
8194
```
82-
95+
8396
- **get(key)**
8497
```javascript
8598
const profile = db.get('shamb0t')
8699
.map((e) => e.payload.value)
87100
// [{ _id: 'shamb0t', name: 'shamb0t', followers: 500 }]
88101
```
89-
102+
90103
- **query(mapper)**
91104
```javascript
92105
const all = db.query((doc) => doc.followers >= 500)
@@ -97,7 +110,7 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
97110
```javascript
98111
db.del('shamb0t').then((removed) => ...)
99112
```
100-
113+
101114
- **events**
102115

103116
```javascript
@@ -106,6 +119,12 @@ docstore.put({ _id: 'hello world', doc: 'some things', views: 10 })
106119

107120
See [events](https://github.com/haadcode/orbit-db/blob/master/API.md#events) for full description.
108121

122+
## Contributing
123+
124+
If you think this could be better, please [open an issue](https://github.com/orbitdb/orbit-db-docstore/issues/new)!
125+
126+
Please note that all interactions in @orbitdb fall under our [Code of Conduct](CODE_OF_CONDUCT.md).
127+
109128
## License
110129

111130
[MIT](LICENSE) ©️ 2015-2018 shamb0t, Haja Networks Oy

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
9+
"keywords": [
10+
"orbitdb",
11+
"orbit-db"
12+
"docstore"
13+
],
914
"author": "shamb0t",
1015
"license": "MIT",
1116
"dependencies": {

0 commit comments

Comments
 (0)