orbit-db-pouch

0.0.6 • Public • Published

orbit-db-pouch

Gitter Matrix Discord

Key-Value database for orbit-db backed by PouchDB.

A key-value datastore for OrbitDB backed by the PouchDB. Orbit handles IPFS + authentication + creating a cryptographic trail of changes. PouchDB is really good at being a searchable database with strong revisioning.

Used in orbit-db.

Install

Usage

First, create an instance of OrbitDB:

const PouchStore = require('orbit-db-pouch')
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')

const ipfs = new IPFS()
const orbitdb = await OrbitDB.createInstance(ipfs)

Add custom datastore type

OrbitDB.addDatabaseType("pouch", PouchStore)

Create a datastore with a schema. In this example we're saving baseball players. We'll add 4 different indexed fields. Indexes and can unique.

store = await orbitdb.open("baseballplayers", {
    create: true, 
    type: "pouch"
})

Once opened the PouchDB can be accessed with ".db":

await store.db.allDocs() //see PouchDB documentation for more.

License

MIT

Package Sidebar

Install

npm i orbit-db-pouch

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

50.9 kB

Total Files

48

Last publish

Collaborators

  • ptoner