pouchdb-community / pouchdb-replication-stream

Replicate PouchDB/CouchDB databases with Node.js-style streams
Apache License 2.0
189 stars 58 forks source link

Doesn't include revisions after loaded?? #68

Open Progklui opened 7 years ago

Progklui commented 7 years ago

Hi there,

I am experiencing a pretty strange issue. I am saving my pouchdb database with the following code:

location = locCurrent+'/currentDatabase.txt';

fs.existsSync(locCurrent) || fs.mkdirSync(locCurrent);

var wsCurrent = fs.createWriteStream(location);

pdb.dump(wsCurrent, {revs_: true}).then(function (res) {
  console.log(res);
});

I load the database with the following code:

var rs = fs.createReadStream(locationDatabase);

pdb.load(rs).then(function (res) {
  console.log(res);

  implementIndex(locationDatabase); 
  location.href = "index.html";
}).catch(function (err) {
  console.log(err);
});

Somehow I can't read the revisions which have been created in the database before the dump in the loaded database-they somehow get lost. Before loading the database all the content of it gets erased for info.

Could anyone please help me.

Many thanks!