pouchdb-updateif

Add update sugar methods over get/put

Usage no npm install needed!

<script type="module">
  import pouchdbUpdateif from 'https://cdn.skypack.dev/pouchdb-updateif';
</script>

README

pouchdb-updateif

Utilities for conditional updating of Pouch/Couch objects

Installation

$ npm install pouchdb-updateif

Example

const asDesignDoc = require('couch-asdesigndoc')
const PouchDB = require('pouchdb-node')
PouchDB.plugin(require('pouchdb-updateif')

let db = new PouchDB('example')
db.updateIfChanged(asDesignDoc({
  _id: '_design/test',
  views: {
    simple: {
      map(doc) { emit(doc.date, doc.title) }
    }
  }
})