3.0.0 • Published 5 years ago
couchdb-transactions
Licence
MIT
Version
3.0.0
Deps
0
Size
15 kB
Vulns
0
Weekly
0
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.
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