# pouchdb-upsert-bulk

> Upsert bulk plugin for PouchDB

Latest version **1.0.2** (published 2016-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install pouchdb-upsert-bulk
pnpm add pouchdb-upsert-bulk
yarn add pouchdb-upsert-bulk
bun add pouchdb-upsert-bulk
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-12-06 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Tom Vincent |
| Maintainers | tlvince |
| Keywords | pouchdb, upsert, bulk |

## Links

- npm: https://www.npmjs.com/package/pouchdb-upsert-bulk
- Repository: https://github.com/tlvince/pouchdb-upsert-bulk
- Homepage: https://github.com/tlvince/pouchdb-upsert-bulk#readme
- Issues: https://github.com/tlvince/pouchdb-upsert-bulk/issues
- npm.io page: https://npm.io/package/pouchdb-upsert-bulk

## Recent versions

- 1.0.2 (latest) — 2016-12-06
- 0.0.0-development — 2016-12-06
- 1.0.1 — 2016-12-06
- 1.0.0 — 2016-12-06

## README

# pouchdb-upsert-bulk

[![Build Status][travis-image]][travis-url]
[![npm version][npm-image]][npm-url]
[![License][license-image]][license-url]

[travis-url]: https://travis-ci.org/tlvince/pouchdb-upsert-bulk
[travis-image]: https://img.shields.io/travis/tlvince/pouchdb-upsert-bulk.svg
[npm-url]: https://www.npmjs.com/package/pouchdb-upsert-bulk
[npm-image]: https://img.shields.io/npm/v/pouchdb-upsert-bulk.svg
[license-url]: https://opensource.org/licenses/MIT
[license-image]: https://img.shields.io/npm/l/pouchdb-upsert-bulk.svg

> Upsert bulk plugin for PouchDB

```js
db.allDocs({include_docs: true})
//=> {rows: [{doc: {_id: '1', _rev: '1', prop: 'foo', other: true}}]}

// Merge
db.upsertBulk([{_id: '1', prop: 'bar'}])
  .then(() => db.allDocs({include_docs: true}))
  //=> {rows: [{doc: {_id: '1', _rev: '2', prop: 'bar', other: true}}]}

// Replace
db.upsertBulk([{_id: '1', prop: 'bar'}], {replace: true})
  .then(() => db.allDocs({include_docs: true}))
  //=> {rows: [{doc: {_id: '1', _rev: '3', prop: 'bar'}}]}
```

**Note** only tested in Node >=6.

## Usage

```shell
npm install --save pouchdb-upsert-bulk
```

```js
import PouchDB from 'pouchdb'
import upsertBulk from 'pouchdb-upsert-bulk'

PouchDB.plugin(upsertBulk)
```

## API

### `upsertBulk(<docs> [, opts])`

Perform a bulk upsert (update or insert) operation. Inserts new docs. Merges existing docs.

* `opts.replace`: **replaces** existing docs

## Future work

* Browser support
* [pouchdb-upsert][]-like diff functions

[pouchdb-upsert]: https://github.com/pouchdb/upsert

## Author

© 2016 Tom Vincent <git@tlvince.com> (https://tlvince.com)

## License

Released under the [MIT license](http://tlvince.mit-license.org).

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