Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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