I have an existing working application that uses channels to sync data from a CouchBase database (5.0.1) using SyncGateway (1.5.1) to a Cordova application built with the Couchbase-Lite-PhoneGap-Plugin . The number of objects is some channels is causing performance issues (342K objects). I was trying to see if I could use filtered replication on the pull sync to reduce the number of objects without having to change the Channel architecture.
You’re trying to create a pull filter. Sync Gateway doesn’t support those; they’re not scalable (since they rely on running a JavaScript function on the server once for every document in the database, per user that pulls.) That’s why SG adds the concept of channels, which perform the same filtering but in a much more efficient way.
Check out the documentation on channels and sync functions. Then you can define a channel for the subset of documents you want the client to have, and specify that channel name to the CBL replicator.
Your initial post says you were reading Apache CouchDB documentation. That’s not our product and not our documentation. If you have suggestions about our docs, there is a feedback button at the bottom of every page that you can use.
Your are correct - I didn’t even notice that - the product names are so similar and sometimes the APIs match up so sometimes it is confusing - sorry about that. I think what happened was I started on https://developer.couchbase.com/documentation/mobile/current/references/couchbase-lite/rest-api/index.html#/server/post__replicate and saw the “filter” option in the _replicate post body which seemed to indicate you could specify a filter function and started to google it to find more information which led me to the other pages. I will post some feedback to the documentation page. Thanks for your help.