pouchdb-community / pouchdb-replication-stream

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

Support of PouchDB v5.0.0 #41

Closed oliviertassinari closed 9 years ago

oliviertassinari commented 9 years ago

Do we support PouchDB v5.0.0? My first test migrating from v4.0.0 wasn't successful.

nolanlawson commented 9 years ago

Yes, there are no incompatibilities between 4.0.0 and 5.0.0. If you found an issue, can you describe in more detail what happened?

ronycohen commented 9 years ago

with PouchDB V5.0.0

and with the basic test :


var pouch = require('pouchdb');
var pouchRepStream = require('pouchdb-replication-stream');
pouch.plugin(pouchRepStream.plugin);
var fs = require('fs');

var url = "https://login:pwd@api.myapp.com/couchDB/DBName";

   var db = new pouch(url);
    var ws = fs.createWriteStream('output.txt');
    return db.dump(ws)
        .then(function(res){
          console.log("success",res);
        }).catch(function(e){
          console.log("error",e);
        });

I have in theoutput.txt only 1 line :

{"version":"1.2.4","db_type":"http","start_time":"2015-10-08T15:41:05.737Z","db_info":{"db_name":"DBName","doc_count":6,"doc_del_count":1,"update_seq":785,"purge_seq":0,"compact_running":false,"disk_size":8630386,"data_size":39177,"instance_start_time":"1442668989564061","disk_format_version":6,"committed_update_seq":785,"host":"https://api.myapp.com:/couchdb/DBName","auto_compaction":false,"adapter":"http"}}
colinskow commented 9 years ago

I confirmed this works fine with PouchDB 4.0.3, but 5.0.0 crashes after writing the first line without ever resolving or rejecting the Promise.

Ampakinetic commented 9 years ago

+1 also not finishing here running PouchDB 5.0.0

nolanlawson commented 9 years ago

fixed by fc17211b55037276626d57a8096782ecca4b125d

Ampakinetic commented 9 years ago

Thank you very much for fixing this, I had a poke around the code looking for something obvious but your commit shows there was quite a bit more to it. Really appreciated!

nolanlawson commented 9 years ago

No prob! The important part turned out to be not passing in the stream object as a constructor param: https://github.com/nolanlawson/pouchdb-replication-stream/blob/c3b2aef90773c3254f6587f246eaf3390d2f46ec/lib/index.js#L37-L40

oliviertassinari commented 9 years ago

Awesome, I will try to use pouchdb@5.0.0 :+1:.