orbit-db-pouch
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.