pouch-random-update

0.0.3 • Public • Published

pouch random update

Update a random doc in pouchdb.

api

update(db, docs [, updateFn])

install

$ npm install pouch-random-update

Example

var Pouch = require('pouchdb');
var update = require('pouch-random-update');
 
var pouch = new Pouch('some-db');
pouch.allDocs({
  include_docs: true
}).then(function(resp) {
  var docs = resp.rows.map(function(row) {
    return row.doc;
  });
  setInterval(function() {
    // default updateFn returns promise from pouch.put()
    update(db, docs).then(function(resp) {
      console.log(resp);
    });
  }, 3000);
});

/pouch-random-update/

    Package Sidebar

    Install

    npm i pouch-random-update

    Weekly Downloads

    4

    Version

    0.0.3

    License

    ISC

    Last publish

    Collaborators

    • nichoth