Closed conor-mac-aoidh closed 9 years ago
Thanks for the contribution! Just a few suggested changes:
opts
object, I would prefer to just explicitly attach opts.filter
.Thanks!
Well, in my case I need access to opts.view, opts.filter and opts.query_params. I don't see the point in restricting access to other options, maybe you could elaborate on why you think that's a good idea?
Ok, I'll add some tests and documentation later this evening.
Well, I guess I had envisioned that this plugin would be a "simplified" version of replication, so I wouldn't carry all the baggage from replication itself. And I admit I'm not even familiar with the view
or query_params
options.
But I guess if you need specific options for some specific _replicate
endpoint (are you using Couchbase/Cloudant/something else?), then yeah, the only way would be to pass all the options in. So I guess this is fine. :)
Ok cool. I'm actually using this to build a replication stream from couchdb, to be bulk loaded into pouchdb on the frontend. We were having an issue where pouch would make /a ton/ of HTTP calls to fetch different revs from the remote db. As a solution, I added a route on our API which streams a filtered view of the db to the client in one request.
Yup, that's exactly what I intended it for. Glad it's helping you out. :)
I think this is the kick in the pants I needed to finally implement an Express endpoint for this thing. Was kinda hoping somebody else would, but nobody's risen to the occasion yet. Time to roll up the old sleeves...
Hmm i have an express route for our own api, i could use a modified version of this and submit a pull request tomorrow if you like?
Cool! I was thinking the express route should be its own separate plugin, though. Can you publish it as an npm module?
As for this module, expect it to get updated and published within the next few minutes; I'm just cleaning up your PR, adding tests and docs, etc. :)
@conor-mac-aoidh check out #24
Ok cool looks good. Im busy tonight but will have a proper look tomorrow afternoon!
I can do a separate module for the express route no problem, but its fairly minimal/basic atm - basically just a small function that calls this module. I could add passing of the replication parameters via the url/query string, which would make it more like couchdb - a HTTP API.
Cool, gonna close this in favor of the other one. Try it out and let me know if it works for your use case.
This patch enables the user to pass custom replication options. This is useful for things like filtered replication.