couchdb-transactions

3.0.0 • Public • Published

Couchdb transactions

Inspired by txn this library loads, modifies and commits documents to couchdb. It also will retry failed requests. The libray has zero dependencies but requires an instance of nano.

pipeline status coverage report

Usage

const couchdbTxn = require('couchdb-transactions');
const db = require('nano')('http:....');

function sumTransaction(doc) {
    doc.sum = 1 + (doc.sum || 0);
}

let txn = couchdbTxn(db, sumTransaction);

let doc = {_id:'xyz'};

txn(doc, function (err, response){
    console.log('response', response);
);

Contributing

Please respect the .eslintrc configuration.
Also, you will need to create a .env file with the URL of your CouchDB server.
See .env.sample

Package Sidebar

Install

npm i couchdb-transactions

Weekly Downloads

6

Version

3.0.0

License

MIT

Unpacked Size

15.6 kB

Total Files

8

Last publish

Collaborators

  • p.revington