pouchdb-upsert-if-changed

1.0.1 • Public • Published

pouchdb-upsert-if-changed

Build Status npm version License

Upsert if changed plugin for PouchDB

const doc = { _id: 'foo' }
db.put(doc)
  // Does nothing
  .then(() => db.upsertIfChanged(doc))
  // Upserts
  .then(() => db.upsertIfChanged({_id: 'foo', bar: 'baz'}))

Installation

npm install --save pouchdb-upsert-if-changed

Usage

upsertIfChanged(<doc>)

import PouchDB from 'pouchdb'
import upsert from 'pouchdb-upsert'
import upsertIfChanged from 'pouchdb-upsert-if-changed'
 
PouchDB
  .plugin(upsert)
  .plugin(upsertIfChanged)

Author

© 2017 Tom Vincent git@tlvince.com (https://tlvince.com)

License

Released under the MIT license.

/pouchdb-upsert-if-changed/

    Package Sidebar

    Install

    npm i pouchdb-upsert-if-changed

    Weekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • tlvince