Callbags for streaming couchdb data
npm i callbag-couchdb
See CouchDB's GET /{db}/_all_docs
endpoint for info.
Takes a db
string and params
and streams all the documents.
const { pipe, forEach } = require('callbag-basics')
const { allDocs } = require('callbag-couchdb')
pipe(
allDocs('http://root:root@localhost:8000/some_store'),
forEach(console.log)
)
See CouchDB's POST /{db}
endpoint for info.
Takes a db
string and inserts the documents. Produces objects indicated if it succeeded and the resulting IDs.
const { pipe, fromIter, forEach } = require('callbag-basics')
const { saveEach } = require('callbag-couchdb')
pipe(
fromIter([
{ foo: 1, bar: 'Hello world' },
{ foo: 1, bar: 'foobar bazu qux' },
{ foo: 2, bar: 'testing 123' }
]),
saveEach('http://root:root@localhost:8000/some_store'),
forEach(console.log)
)