Skip to content

tlvince/pouchdb-upsert-if-changed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

Upsert if changed plugin for PouchDB

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published