# couchdb-transactions

> Couchdb all or nothing transactions without deps

Latest version **3.0.0** (published 2021-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install couchdb-transactions
pnpm add couchdb-transactions
yarn add couchdb-transactions
bun add couchdb-transactions
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-11-26 |
| First published | 2016-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pedro Narciso García Revington |
| Maintainers | p.revington |
| Keywords | couchdb, transactions, txn |

## Links

- npm: https://www.npmjs.com/package/couchdb-transactions
- Repository: https://gitlab.com/revington/couchdb-transactions
- Homepage: https://gitlab.com/revington/couchdb-transactions#readme
- Issues: https://gitlab.com/revington/couchdb-transactions/issues
- npm.io page: https://npm.io/package/couchdb-transactions

## Recent versions

- 3.0.0 (latest) — 2021-11-26
- 2.0.1 — 2018-02-13
- 2.0.0 — 2018-02-13
- 1.0.0 — 2016-06-13

## README

# Couchdb transactions

Inspired by [txn](https://github.com/jhs/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](https://github.com/dscape/nano).

[![pipeline status](https://gitlab.com/revington/couchdb-transactions/badges/master/pipeline.svg)](https://gitlab.com/revington/couchdb-transactions/-/commits/master)
[![coverage report](https://gitlab.com/revington/couchdb-transactions/badges/master/coverage.svg)](https://gitlab.com/revington/couchdb-transactions/-/commits/master)


## 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](.env.sample)

---
_Source: https://npm.io/package/couchdb-transactions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
