Skip to content

jamen/callbag-couchdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callbag-couchdb

Callbags for streaming couchdb data

Install

npm i callbag-couchdb

Usage

allDocs(db, params)

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)
)

saveEach(db)

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)
)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published