kazu2012 / persevere-framework

Automatically exported from code.google.com/p/persevere-framework
0 stars 0 forks source link

Replication with CouchDB #142

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Add the ability to replicate data with a CouchDB server. Here is the (semi-
pseudo) code that Jan from CouchDB gave me on how to do it:
// replicate from couchdb

var persevere = new Persevere("foo");
var couchdb = new CouchDB("foo");
var docs_by_seq = couchdb.view("_all_docs_by_seq", {startkey: 0});

var last_seq = docs_by_seq.seq_nr;
var new_docs.rows;

for(var idx in new_docs) {
  var id = new_docs[idx].id;
  var doc = couchdb.open(id); // hidden GET request
  if(doc._deleted) {
    persevere.delete(doc);
  } else {
    persevere.save(doc);
  }
} 

Original issue reported on code.google.com by kris...@gmail.com on 29 Apr 2009 at 4:53

GoogleCodeExporter commented 8 years ago

Original comment by kris...@gmail.com on 30 Apr 2009 at 4:37