Reputation: 383
I am using Angular(js) and pouchdb as local db and couchbase as remote database. angularjs code
.run(function ($pouchDB) {
$pouchDB.setDatabase("local");
$pouchDB.replicateFrom("http://couchbaseServer/office");
$pouchDB.replicateTo("http://couchbaseServer/mobile");
})
//pouchDB service code
this.replicateTo = function(remoteDB) {
database.replicate.to(remoteDB).on('complete', function () {
// yay, we're done!
alert("replicationTo done");
}).on('error', function (err) {
// boo, something went wrong!
alert("data was not replicated to server, error - " + err);
});
};
this.replicateFrom = function(remoteDB) {
database.replicate.from(remoteDB).on('complete', function () {
// yay, we're done!
alert("replicationFrom done");
}).on('error', function (err) {
// boo, something went wrong!
alert("data was not replicated from server, error - " + err);
});
};
i get an error on the replicate to, invalid doc id
this is replicating everything to prove the concept. My next question will be to filter the replicate to data to only the data generated locally.
Upvotes: 0
Views: 244