Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Forked from indolering/gist:b5d95ebd51ff75fa2258
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/cf4815aef7c7fcbda93f to your computer and use it in GitHub Desktop.
Save nolanlawson/cf4815aef7c7fcbda93f to your computer and use it in GitHub Desktop.
var dbname = "dbtemp" + randomName();
var docname = "doc" + randomName();
var remote = 'http://localhost:5984/'+ dbname + ~~(Math.random() * 1000000)
var PouchDB = require('pouchdb');
var pouch = new PouchDB(dbname);
pouch.put({_id: docname}).then(function() {
pouch.put({_id: docname}).then(function() {
pouch.replicate.to(remote).on('error', function(err) {
console.log('error');
console.log(err);
console.log(err.stack);
}).on('complete', function (resp) {
console.log('complete');
console.log(resp);
}).on('change', function (change) {
console.log('change');
console.log(change);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment